> On 14 Nov 2020, at 20.06, Afriyie Abraham Kwabena <afriyie.abra...@gmail.com> > wrote: > > Hi, > > My question is about multiple HTTP client polling an HTTP server randomly > with a PATCH request to update a resource at the server running in front of > MongoDB. The clients poll with their different ids and a valid time in their > request. At the server, I can keep their ids and their different times. > How can detect at the server if a specific client stop polling. I would like > to write a function that detect at the HTTP server if a specific client stop > polling and then remove its resources after some time from a database. Am > using gorilla/mux package for the server. Any help, am new to Golang > programming. >
I think this is not Go specific, but more like engineering in general. My suggestion is you can store the last time when user request to PATCH endpoint in some storage or internal memory (like map[userID]timestamp) and then have some worker that check the timestamp to clean it up every X seconds or minutes. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/EA52034E-DFED-4853-8720-402BF5E8967F%40gmail.com.