mirror of
https://github.com/gabehf/Koito.git
synced 2026-03-07 21:48:18 -08:00
chore: call relay early to prevent missed relays (#145)
* chore: call relay early to prevent missed relays * fix: get current time in tz for listen activity (#146) * fix: get current time in tz for listen activity * fix: adjust test to prevent timezone errors
This commit is contained in:
parent
92648167f0
commit
1eb1cd0fd5
1 changed files with 5 additions and 4 deletions
|
|
@ -90,6 +90,11 @@ func LbzSubmitListenHandler(store db.DB, mbzc mbz.MusicBrainzCaller) func(w http
|
||||||
utils.WriteError(w, "failed to read request body", http.StatusBadRequest)
|
utils.WriteError(w, "failed to read request body", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cfg.LbzRelayEnabled() {
|
||||||
|
go doLbzRelay(requestBytes, l)
|
||||||
|
}
|
||||||
|
|
||||||
if err := json.NewDecoder(bytes.NewBuffer(requestBytes)).Decode(&req); err != nil {
|
if err := json.NewDecoder(bytes.NewBuffer(requestBytes)).Decode(&req); err != nil {
|
||||||
l.Err(err).Msg("LbzSubmitListenHandler: Failed to decode request")
|
l.Err(err).Msg("LbzSubmitListenHandler: Failed to decode request")
|
||||||
utils.WriteError(w, "failed to decode request", http.StatusBadRequest)
|
utils.WriteError(w, "failed to decode request", http.StatusBadRequest)
|
||||||
|
|
@ -234,10 +239,6 @@ func LbzSubmitListenHandler(store db.DB, mbzc mbz.MusicBrainzCaller) func(w http
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
w.Write([]byte("{\"status\": \"ok\"}"))
|
w.Write([]byte("{\"status\": \"ok\"}"))
|
||||||
|
|
||||||
if cfg.LbzRelayEnabled() {
|
|
||||||
go doLbzRelay(requestBytes, l)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue