E
E
Eugene2016-07-20 22:57:46
JavaScript
Eugene, 2016-07-20 22:57:46

Emit events by date in database?

Good day.
I am writing a project - an auction system. In the database, each lot includes a certain initial set of data, including a start and end timestamp (formed by adding one hour to the start date). The lot is not limited to these limits, since any bid accepted in the 10-second period before the end of the auction adds some more time to the end date. It is necessary to track the end of the auction and send a request to the Front-end.
At the moment, I made an object using setTimeout and key: value. At the time of the bet, if the end of the lot is less than 10 seconds, I update the data in the database, clean the old timer and create another one with a new time.
The current implementation seems to be some kind of ridiculous and in general the wrong way, please tell me which way to dig. Cron, message queue? How to make the right organization?
I use rethinkdb as the database .

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artemy, 2016-07-21
@MetaAbstract

I think we need to dig in the direction of WebRTC, because. you are trying to build a real time system. But you can change the requirements for the system and make life easier.
Generally speaking, there is a predicate LotFinished(lot,{bids})={true|false}. And how to implement it is the second question.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question