From 5726067315039a452ab956f739f9cc9377c79d33 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Mon, 9 Sep 2024 01:02:48 +0000 Subject: [PATCH] tumblrandom: some fixups --- go/tumblrandom/tumblrandom.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/go/tumblrandom/tumblrandom.go b/go/tumblrandom/tumblrandom.go index 3811448d62..d022ee4da4 100644 --- a/go/tumblrandom/tumblrandom.go +++ b/go/tumblrandom/tumblrandom.go @@ -205,7 +205,7 @@ type likesResponse struct { } var ( - refreshBuf map[string][]Post + refreshBuf = map[string][]Post{} refreshBufMu sync.Mutex ) @@ -279,6 +279,9 @@ func (a *app) refreshLikes(rw http.ResponseWriter, r *http.Request) { urlSuffix = lr.Response.Links.Next.Href if urlSuffix != "" { + refreshBufMu.Lock() + refreshBuf[refreshSess] = likes + refreshBufMu.Unlock() fmt.Fprintf(rw, ` @@ -286,8 +289,8 @@ func (a *app) refreshLikes(rw http.ResponseWriter, r *http.Request) {
- - + +