Last active
November 4, 2022 11:57
-
-
Save x-labz/6f6f8c5e0ba236ccd3d7bc248a017815 to your computer and use it in GitHub Desktop.
task-keepalive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function keepAliveTask(task) { | |
while (true) { | |
try { | |
log('starting task:', task.name) | |
task() | |
} | |
catch (error) { | |
log('task crashed:', task.name, error ) | |
} | |
} | |
} | |
// starting the service tasks | |
keepAliveTask( task1 ) | |
keepAliveTask( task2 ) | |
keepAliveTask( task3 ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment