I have a simple plugin that reads a file and runs some code periodically.
const task = () => { while (1){ // Reads file and runs code if data on it }}export default defineNitroPlugin(() => { task();});
const task = () => { while (1){ // Reads file and runs code if data on it }}export default defineNitroPlugin(() => { task();});
The while makes the server go stuck, is there an alternative to run a code like that in the server background without breaking the rest of the server? Thanks.