hashmaths / jeeves

An IRC bot written in Node.
MIT License
3 stars 1 forks source link

Reminders #6

Closed nullren closed 6 years ago

nullren commented 7 years ago

I would like to ask Jeeves to remind me about something either in the channel or in PM and to be reminded at the time of choosing.

Basically, we need some priority queue structure that can be persisted when shut down and reloaded when started up.

Each item will be an object containing {who, what, when, where} sorted by when.

The way I was thinking this could be be accomplished might need to be reconciled with what we can actually do in nodejs. What I was thinking was having some separate thread (or event loop) that is looking at the next item in the queue and has a timeout set til when that item is due.

Once the timeout expires, Jeeves sends the message, removes the item, then looks at the queue and starts the next timeout.

If while waiting a new item is added to the queue, this should cancel the current timeout and Jeeves should look back at the queue and start the next timeout.

wridgers commented 6 years ago

Your implementation suggestion sounds very reasonable.

Blocked by #8