Open
Description
- nest js queue tutorial: https://youtu.be/7J-ilYJqh9U?si=f9tZFM3FAWb7mbY4
- official docs: https://docs.nestjs.com/techniques/queues
- node js bull https://www.npmjs.com/package/bull
- run redis with docker https://www.docker.com/blog/how-to-use-the-redis-docker-official-image/
? the mod operation should track token expenditure based on some CPU resource usage
? the mod operation should update progress
Abstract implementation of running mod operations in background
async applyMod(modID: string, applyModDto: ApplyModDto) {
// load the mod to apply
// load the dto of mod params
// check if user has rights to access fileID
// validate mod params
// return error if incorrect/insufficient mod params
// create background task to process this mod
// return task id so that people can get the status of the mod
console.log(applyModDto);
return modID;
}
async checkModOpStatus(taskID: string) {
// validate if the requester is the creator of this task
// check the status of the task with given task id
// return processing if still not complete
// return the file id of result file, and no of tokens consumed when complete
return taskID;
}