
Security News
Ruby's Bundler 4.0.18 Extends Cooldown to bundle lock and bundle cache
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.
@sisense/task-manager
Advanced tools
Solution for management of your resource-intensive and time-consuming tasks
task-managerThis library helps solve the common development problem of managing complex, resource-intensive asynchronous tasks (workflows).
Imagine you have a request for a Service that needs to execute a sequential workflow consisting of several lengthy asynchronous steps in order to return the final result.

If this task takes a significant amount of time, the user may want to cancel it manually or by timeout. If this task has multiple lengthy asynchronous steps and a cancel request can be made at any point in this complex flow, you would want to cancel it as soon as possible and skip all subsequent steps. Each step's cancellation may require its own logic to clean up and free consumed resources.

If resources for doing smth 1 or doing smth 2 are limited - you may want to add some internal Queue to collect incoming requests and perform the execution of these workflow steps one by one.
In task-manager this possibility implemented as an addon and can be optionally added if needed. The basic behavior of task-manager includes only canceling logic.
task-manager:You create your own TaskManager where define ExecutionFlow. ExecutionFlow made of Steps - for each Step you define RunLogic - async function that performs logic you want to do, like doing smth 1, and CancelLogic - async function that performs all cleaning up you want to do if canceling happened during this step.
On incoming request, you create TaskPassport that contains the type of task and payload of your request.
Save taskId of the task you are performing to be able to cancel it if needed.
const STEP_2_RESULT = 'step_2_result';
const SOME_RUNTIME_VALUE = 'some_runtime_value';
const step1 = new Step(
'step_1_name',
async (task: MyTask) => {
// do something 1
task.addRuntimeInfo('someRuntimeValue', SOME_RUNTIME_VALUE);
// return nothing
},
async () => {
// clean up if canceled during step 1
},
);
const step2 = new Step(
'step_2_name',
async () => {
// do something 2
return STEP_2_RESULT;
},
async () => {
// clean up if canceled during step 2
},
);
class MyTaskManager extends AbstractTaskManager {
executeTestFlow = super.createFlow<MyTaskPassport, MyTaskRuntimeInfo, MyTaskResultData>([
step1,
step2,
]);
}
const manager = new MyTaskManager();
// for each incoming request
const taskPassport = new MyTaskPassport(/* payload */);
const result = await manager.executeTestFlow(taskPassport);
// if cancel request ->
manager.cancel(taskPassport.taskId);
// cancel by timeout
setTimeout(() => {
manager.cancel(taskPassport.taskId);
}, 1000);
FAQs
Solution for management of your resource-intensive and time-consuming tasks
The npm package @sisense/task-manager receives a total of 3,217 weekly downloads. As such, @sisense/task-manager popularity was classified as popular.
We found that @sisense/task-manager demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.

Company News
Socket is now in the AWS Security Hub Extended plan. Adopt it through AWS, apply committed spend, and block malicious open source packages.