Reloads page after 4 seconds of no websocket connection Issue #21
Former-commit-id: 0b4d9626ec5575aeef9bee6c607f15333e988f8f [formerly 0c9c0ac40fa9baf9806a14bf3494a26d774d33ad] [formerly 4cd5ec1d0ff1b15df8a4e9249822642c48395f6b [formerly 1490929655
]]
Former-commit-id: a49791d44fb6019be4d9384b3e30f3c0c5cf0974 [formerly 9b50aac590ac5983b90231f81262877f20707c6d]
Former-commit-id: 21084418f37f3565155d6e485961d8f511bcd91c
0
install/awwkoala.init
Executable file → Normal file
0
install/awwkoala.nginx
Executable file → Normal file
0
static/img/awwkoala.png
Executable file → Normal file
Before Width: | Height: | Size: 1004 B After Width: | Height: | Size: 1004 B |
0
static/img/gomascot.png
Executable file → Normal file
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
0
static/img/nginx.png
Executable file → Normal file
Before Width: | Height: | Size: 659 B After Width: | Height: | Size: 659 B |
0
static/img/raspberrypi.png
Executable file → Normal file
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.6 KiB |
6
utils.go
@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
@ -89,9 +90,13 @@ func getImportantVersions(p WikiData) []versionsInfo {
|
|||||||
// defer timeTrack(time.Now(), "getImportantVersions")
|
// defer timeTrack(time.Now(), "getImportantVersions")
|
||||||
m := map[int]int{}
|
m := map[int]int{}
|
||||||
lastTime := time.Now().AddDate(0, -1, 0)
|
lastTime := time.Now().AddDate(0, -1, 0)
|
||||||
|
totalTime := time.Now().Sub(time.Now())
|
||||||
for i := range p.Diffs {
|
for i := range p.Diffs {
|
||||||
parsedTime, _ := time.Parse(time.ANSIC, p.Timestamps[i])
|
parsedTime, _ := time.Parse(time.ANSIC, p.Timestamps[i])
|
||||||
duration := parsedTime.Sub(lastTime)
|
duration := parsedTime.Sub(lastTime)
|
||||||
|
if duration.Minutes() < 3 {
|
||||||
|
totalTime += duration
|
||||||
|
}
|
||||||
m[i] = int(duration.Seconds())
|
m[i] = int(duration.Seconds())
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
m[i-1] = m[i]
|
m[i-1] = m[i]
|
||||||
@ -133,6 +138,7 @@ func getImportantVersions(p WikiData) []versionsInfo {
|
|||||||
for _, nn := range importantVersions {
|
for _, nn := range importantVersions {
|
||||||
r = append(r, versionsInfo{p.Timestamps[nn], nn})
|
r = append(r, versionsInfo{p.Timestamps[nn], nn})
|
||||||
}
|
}
|
||||||
|
fmt.Println(totalTime)
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
|