You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the socket client sends events such as edit_cell, it expects an acknowledgment from the server in the form of a cell_edited broadcasted message. Reasonably, this should happen in a short window of time (~few secs or less).
Create a data structure to store expected acknowledgments
Key: hash of some data on event that is known/expected (i.e. event_name+cell_id+uid+contents)
Should be in memory
Needs to have fast search by exact hash, insert, and remove
Set timeouts that check the store on their expiration
Check store for hash
if not in store, ignore/continue
if in store, remove from store + emit timeout error
When an event/error is received, remove from store (aka cancel timeout)
The text was updated successfully, but these errors were encountered:
@jtaylorchang since this will be heavily used, you may have concerns on performance. Any suggestions on data structures/libraries? We effectively need a non-nested dictionary. Can use an object but that may be slow? Also not sure how to deal with modifying objects when considering async actions.
In-memory DB libraries I've found on npm are ~3mb which I'm guessing is too big.
Well since this is a global variable anyways with a single instance that isn't watched by renders, you can simply use a regular object and mutate it (rather than creating a new one or using an immutable). Immutability only matters for efficient component rendering. 3mb package is definitely too big since our bundle size is already getting large and 3mb is massive. (Also I think a database is overkill). Also I don't think you need to worry about race conditions when mutating the object anyways since it's single threaded
When the socket client sends events such as
edit_cell
, it expects an acknowledgment from the server in the form of acell_edited
broadcasted message. Reasonably, this should happen in a short window of time (~few secs or less).The text was updated successfully, but these errors were encountered: