浏览代码

Fix filewatch example

Use last modified time when the time is parsed without error. This prevents an
extra file read at start of watch for a connection.

Fixes #125.
Gary Burd 9 年之前
父节点
当前提交
6b3d49710b
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      examples/filewatch/main.go

+ 1 - 1
examples/filewatch/main.go

@@ -120,7 +120,7 @@ func serveWs(w http.ResponseWriter, r *http.Request) {
 	}
 
 	var lastMod time.Time
-	if n, err := strconv.ParseInt(r.FormValue("lastMod"), 16, 64); err != nil {
+	if n, err := strconv.ParseInt(r.FormValue("lastMod"), 16, 64); err == nil {
 		lastMod = time.Unix(0, n)
 	}