On Commit

6 views
Skip to first unread message

Mark Lester

unread,
Oct 25, 2016, 1:11:55 AM10/25/16
to Sequelize
I am playing with sockets.io, sending the browser messages when the data changes.
Once I got stuff working properly I noticed I was attempting to REST the stuff back out of the DB before it had been committed.
No worries, send the model in the message and just set it in backbone.
But of course my collections dont work either. 
Solutions seem to be
A) send the entire collection data in the message - not very good
B) send the model data and get it added or deleted from the set - thats what its supposed to do actually, but there are still issues with that. In some cases you wil always want to fetch the collection or model, but only when its made it to home base.
C) cache the messages and then emit them upon closure of the transaction they are bound to.
D) same as above, but done outside sequelize, so I have to edit all uses :(

Do we have hooks for calling your own clean ups and post actions on a transaction closure.
Reply all
Reply to author
Forward
0 new messages