forked from mirror/websocket
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.
This commit is contained in:
parent
e2e3d8414d
commit
6b3d49710b
|
@ -120,7 +120,7 @@ func serveWs(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var lastMod time.Time
|
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)
|
lastMod = time.Unix(0, n)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue