dark-swordsman / Ottarr

A user-first media management system
2 stars 0 forks source link

Create Task/Action system #3

Closed dark-swordsman closed 1 year ago

dark-swordsman commented 2 years ago

Task/Action system to allow for queued/historical events.

For example, if a series needs to be hard linked, it will use this system to queue and execute the actions. Also, the user can undo these changes.

We can clean it up and make it better later, but the main focus is to have the ability to create tasks, execute tasks, and undo tasks.


Task system would exist as middleware, basically. It would be more of an event log system where it can log what happened and keep track of events.

dark-swordsman commented 2 years ago

task api -> action breakout/write to DB -> on return, push actions to rabbitmq -> after consumption, update actions

A way to update the status of each action on the front end would be nice. Currently thinking some API endpoint that the consumer calls when it's done with the update for the action in the DB. As well as a websocket system.

This websocket could be managed by a node service for tasks, like a "task master" of sorts. This task master could be the main producer for the queue or something. Though this would require us to make a microservice architecture basically, so the task master and task consumers would be their own node scripts/apis.

dark-swordsman commented 2 years ago
image

So for example: Say we had a modal for a task. Each "action" can exist as a line item or something and they can dynamically update since the state would be updated via websocket. This can even include a pretty progress bar at the top of the task!

Also, we can (probably) use an array locally to act as a buffer for the state, so we don't accidentally skip messages. This is unless react naturally queues state updates. But we will do it just as an uneducated precaution. Probably using Array.prototype.shift() to grab the first, and then using push to add to the buffer.

dark-swordsman commented 2 years ago

Also should use PM2 and their API to have a "Process Manager". Mainly to spawn and manage instances for rabbitmq.