- What's the feature?
This is more of a question / small correctness improvement about the GET /update endpoint's HTTP status code.
The handler forces an update run and then replies with 202 Accepted plus a plain-text body ("All records updated successfully in ...").
From reading the code, ForceUpdate looks synchronous: it sends on the force channel and blocks on forceResult, so updateNecessary (public IP fetch, DNS resolve, provider update) appears to have already completed by the time the handler writes its response:
// internal/server/update.go
errors := h.runner.ForceUpdate(h.ctx) // appears to block until the run is done
...
w.WriteHeader(http.StatusAccepted) // 202
202 Accepted usually means "request accepted, processing not finished yet". If the work is already done when the response is sent, wouldn't 200 OK describe it more accurately? With 202, a client polling the result may think the update is still pending.
Is the 202 intentional (maybe there's an async aspect I'm missing), or just an oversight? If you agree 200 is more correct, I'm happy to send a small PR.
- Extra information?
Noticed this while looking into dyndns2-client compatibility for the same endpoint (#1150).
This is more of a question / small correctness improvement about the
GET /updateendpoint's HTTP status code.The handler forces an update run and then replies with
202 Acceptedplus a plain-text body ("All records updated successfully in ...").From reading the code,
ForceUpdatelooks synchronous: it sends on theforcechannel and blocks onforceResult, soupdateNecessary(public IP fetch, DNS resolve, provider update) appears to have already completed by the time the handler writes its response:202 Acceptedusually means "request accepted, processing not finished yet". If the work is already done when the response is sent, wouldn't200 OKdescribe it more accurately? With202, a client polling the result may think the update is still pending.Is the
202intentional (maybe there's an async aspect I'm missing), or just an oversight? If you agree200is more correct, I'm happy to send a small PR.Noticed this while looking into dyndns2-client compatibility for the same endpoint (#1150).