vocdoni / interoperability

Private repository to manage the interoperability between protocol, API, SDK, UIs and documentation
1 stars 0 forks source link

Make the Publish census async (priority low) #165

Closed p4u closed 4 weeks ago

p4u commented 3 months ago

Currently, /censuses/publish is a sync call. For big census sizes, it might be an issue if the HTTP request takes too long. Depending on the API server setup, after some time the connection might be canceled due to a timeout (502).

To fix this potential issue a new endpoint is added to the API.

POST /censues/:censusId/publish/async

This endpoint enqueues the task and returns the new censusId, using the same JSON body as currently.

Then GET /censuses/:newCensusId/check can be used to query the status of the task.

Note that once check has returned 200, the census info is removed from the queue and it won't be available for /check anymore.