From 338874fddbfd54bfab6950f58f34f407c5a5f1a3 Mon Sep 17 00:00:00 2001 From: Zack Date: Thu, 11 Feb 2016 09:16:46 -0500 Subject: [PATCH] Reloads page after 4 seconds of no websocket connection Issue #21 Former-commit-id: 0b4d9626ec5575aeef9bee6c607f15333e988f8f [formerly 0c9c0ac40fa9baf9806a14bf3494a26d774d33ad] [formerly 4cd5ec1d0ff1b15df8a4e9249822642c48395f6b [formerly 1490929655c6bf5b7dbd2d8370576a71d51d14bc]] Former-commit-id: a49791d44fb6019be4d9384b3e30f3c0c5cf0974 [formerly 9b50aac590ac5983b90231f81262877f20707c6d] Former-commit-id: 21084418f37f3565155d6e485961d8f511bcd91c --- install/awwkoala.init | 0 install/awwkoala.nginx | 0 static/img/awwkoala.png | Bin static/img/gomascot.png | Bin static/img/nginx.png | Bin static/img/raspberrypi.png | Bin utils.go | 6 ++++++ 7 files changed, 6 insertions(+) mode change 100755 => 100644 install/awwkoala.init mode change 100755 => 100644 install/awwkoala.nginx mode change 100755 => 100644 static/img/awwkoala.png mode change 100755 => 100644 static/img/gomascot.png mode change 100755 => 100644 static/img/nginx.png mode change 100755 => 100644 static/img/raspberrypi.png diff --git a/install/awwkoala.init b/install/awwkoala.init old mode 100755 new mode 100644 diff --git a/install/awwkoala.nginx b/install/awwkoala.nginx old mode 100755 new mode 100644 diff --git a/static/img/awwkoala.png b/static/img/awwkoala.png old mode 100755 new mode 100644 diff --git a/static/img/gomascot.png b/static/img/gomascot.png old mode 100755 new mode 100644 diff --git a/static/img/nginx.png b/static/img/nginx.png old mode 100755 new mode 100644 diff --git a/static/img/raspberrypi.png b/static/img/raspberrypi.png old mode 100755 new mode 100644 diff --git a/utils.go b/utils.go index f12fa3c..1340c97 100644 --- a/utils.go +++ b/utils.go @@ -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 }