diff options
author | 2022-12-11 18:07:01 +0100 | |
---|---|---|
committer | 2022-12-12 19:41:30 -0800 | |
commit | ce35b46fee3c891e959d4e5376c26636e5eb90fc (patch) | |
tree | 3fe5bd9fef8884bee51771ca631473ab85c0ec01 /api/category.go | |
parent | e12c263fc9a662bdd8096534c84a006515288ce7 (diff) | |
download | v2-ce35b46fee3c891e959d4e5376c26636e5eb90fc.tar.gz v2-ce35b46fee3c891e959d4e5376c26636e5eb90fc.tar.zst v2-ce35b46fee3c891e959d4e5376c26636e5eb90fc.zip |
Add category feeds refresh
Diffstat (limited to 'api/category.go')
-rw-r--r-- | api/category.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/api/category.go b/api/category.go index 9a351581..64cc036b 100644 --- a/api/category.go +++ b/api/category.go @@ -123,3 +123,20 @@ func (h *handler) removeCategory(w http.ResponseWriter, r *http.Request) { json.NoContent(w, r) } + +func (h *handler) refreshCategory(w http.ResponseWriter, r *http.Request) { + userID := request.UserID(r) + categoryID := request.RouteInt64Param(r, "categoryID") + + jobs, err := h.store.NewCategoryBatch(userID, categoryID, h.store.CountFeeds(userID)) + if err != nil { + json.ServerError(w, r, err) + return + } + + go func() { + h.pool.Push(jobs) + }() + + json.NoContent(w, r) +} |