Skip to content

Times jobs, allows you to add metadata, and collects the job as a JSON string

License

Notifications You must be signed in to change notification settings

hoop33/jobtimer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Job Timer

badge semantic-release

Times jobs, allows you to add metadata, and collects the job as a JSON string

Installation

$ npm install jobtimer

Usage

const { startTimedJob, endTimedJob } = require("jobtimer");

// Start a timed job
const start = startTimedJob({ msg: "myjob" });

// Run some long-running job
const result = await longRunningFunction();

// Add result to job
start.result = result;

// Log the results
console.log(endTimedJob(start));
// {"msg":"myjob","result":"myresult","tpt":137}

Note: tpt stands for Total Processing Time.

License

Copyright © 2020 Rob Warner Licensed under the MIT License

About

Times jobs, allows you to add metadata, and collects the job as a JSON string

Resources

License

Stars

Watchers

Forks

Packages

No packages published