1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00

Reloads page after 4 seconds of no websocket connection Issue #21

Former-commit-id: 0b4d9626ec5575aeef9bee6c607f15333e988f8f [formerly 0c9c0ac40fa9baf9806a14bf3494a26d774d33ad] [formerly 4cd5ec1d0ff1b15df8a4e9249822642c48395f6b [formerly d57713c75724ea940acbc79c4c16e4e174ac9fb9 [formerly 1490929655]]]
Former-commit-id: a49791d44fb6019be4d9384b3e30f3c0c5cf0974 [formerly 9b50aac590ac5983b90231f81262877f20707c6d]
Former-commit-id: 21084418f37f3565155d6e485961d8f511bcd91c
Former-commit-id: 338874fddb
This commit is contained in:
Zack 2016-02-11 09:16:46 -05:00
parent 219237ecdd
commit 15acd517da
7 changed files with 6 additions and 0 deletions

0
install/awwkoala.init Executable file → Normal file
View File

0
install/awwkoala.nginx Executable file → Normal file
View File

0
static/img/awwkoala.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1004 B

After

Width:  |  Height:  |  Size: 1004 B

0
static/img/gomascot.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

0
static/img/nginx.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 659 B

After

Width:  |  Height:  |  Size: 659 B

0
static/img/raspberrypi.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

@ -1,6 +1,7 @@
package main
import (
"fmt"
"io/ioutil"
"log"
"math/rand"
@ -89,9 +90,13 @@ func getImportantVersions(p WikiData) []versionsInfo {
// defer timeTrack(time.Now(), "getImportantVersions")
m := map[int]int{}
lastTime := time.Now().AddDate(0, -1, 0)
totalTime := time.Now().Sub(time.Now())
for i := range p.Diffs {
parsedTime, _ := time.Parse(time.ANSIC, p.Timestamps[i])
duration := parsedTime.Sub(lastTime)
if duration.Minutes() < 3 {
totalTime += duration
}
m[i] = int(duration.Seconds())
if i > 0 {
m[i-1] = m[i]
@ -133,6 +138,7 @@ func getImportantVersions(p WikiData) []versionsInfo {
for _, nn := range importantVersions {
r = append(r, versionsInfo{p.Timestamps[nn], nn})
}
fmt.Println(totalTime)
return r
}