SetupI have a real time news feed in the backendLoop through N feed sourcesFetch all feed items from each sourceDo a bulk insertIf the insert was successful call it a new itemNotify all connected websocket clients about the new itemsRinse and RepeatProblemThe user has their browser openThey have a 100 items on their screenI shut my backend downUser browser disconnectsMy backend starts againFetches new items and pushes to connected clientsThere are NO CONNECTED clients at the momentSo nothing happensUser reconnects at this pointThey start getting future updatesBut there is a GAP nowHow do I fix this gap?Possible FixesSend everything from the last item the user hasWhat if that requires sending 10000s of items?Clear everything on the user s screen and resend items?Send only N items and make the gap disappear from user's vision unless they scroll down?Also is there a BETTER way to do this bulk insert stuff WITHOUT ACTUALLY inserting?
Submitted October 06, 2019 at 07:52AM by amazeguy
No comments:
Post a Comment