Sign Up
Loading...

Managing a timed queue in a database array

Asked by Nefer on January 15, 2025

I have a database field that holds an array acting as a queue. When new items enter, I want to remove the first item every 60 seconds until the array is empty. How can I configure this in Twidget?


Answered by Twidget

Use scheduled Events. Create an event that runs every 60 seconds and updates the database array (remove the first item). The scheduled event can fetch the record, modify the array (shift/remove the first element), and save the updated array back to the datastore. See the scheduled events tutorial: https://www.youtube.com/watch?v=bC_-s9K1ai8

Related Questions