
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Controllable and resonable job queue manager
npm install --save jobman
The example code:
const jobman = require('jobman')
const man = jobman({ // create new jobman object
max: 3, // max concurrent jobs
jobStart: (job, man)=>{ // when A job will start
if(job.prop==5) return false // return FALSE will cancel the job
},
jobEnd: (job, man)=>{ // when A job did end
console.log('result: ', job.prop, job.error || 'ok')
},
jobTimeout: (job, man)=>{ // when A job timeout
console.log('timeout: ', job.prop)
},
allStart: (info, man)=>{ // all jobs will start
console.log('all jobs will start')
},
allEnd: (info, man)=>{ // all jobs done
console.log('all end', man.isDone)
// also clear all pending jobs, cancel running callbacks
man.clear(true)
},
autoStart: true // start monitor when create
})
for(let i=0;i<10;i++){
man.add(cb=>{ // add A job
task(i, cb)
}, i) // job.prop = i
}
man.add(0, cb=>{ // insert A job into 0 index
task(99, cb)
}, {id: 'insert to first!', timeout: 500}) // the job timeout is 500ms
function task(i, cb){ // dummy task function
setTimeout(()=>{
if(i==3) cb('bad') // cb with error
else cb() // cb with ok
}, 1000) // async happen at 1 second
}
The result:
all jobs will start
timeout: { id: 'insert to first!', timeout: 500 }
result: 0 ok
result: 1 ok
result: 2 ok
result: 3 bad
result: 4 ok
result: 6 ok
result: 7 ok
result: 8 ok
result: 9 ok
all end true
config
max number of concurrence jobs.
ms to wait for --A job--, trigger jobTimeout event after the time
ms to pass into setInterval check internally
callback function after --A job-- timeout, return false will book another timeout
callback function before --A job-- will start, return false will cancel this job
callback function after --A job-- did start, job.state become run
callback function after --A job-- callback invoked, with man.lastError set to result error
callback function before --ALL job-- start run, useful for init, info is user passed with man.start(info)
callback function when --ALL job-- finished run, info is user passed with man.end(info)
manObject
jobFn is with callback for one job, cb(err) have to be called for each job. jobProp will become job.prop
function to start current jobman, use man.stop to stop it, trigger man.allStart with first arg set to info
function to stop current jobman, use man.start to start again
trigger man.allEnd with first arg set to info, cancelPending will cancel pending jobs
Remove all pending jobs, cancel running jobs if cancelRunningJobs is true
the config object passed into jobman
the jobs array internally, query for it for state, length etc.
prop to get if the job monitor is is running (not stopped)
prop to get if all job ended
prop to get pending jobs in queue
prop to get running jobs in process
prop to get current available job runner slot
jobman start counter, from 0, after first start() will be 1, after next start() plus 1
jobObject
the jobFn function passed into man.add()
when job callback called with error, set to it with the error
the prop to passed into man.add()
set timeout for individual job
internal state for each job, value is run/done/error/timeout/cancel
FAQs
Controllable and resonable job queue manager
We found that jobman demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.