npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

nv-remote-cron

v0.0.3

Published

nv-remote-cron ===================== - cron task using redis

Readme

nv-remote-cron

  • cron task using redis

install

  • npm install nv-remote-cron

usage

  const RCron = require("nv-remote-cron")
  var cron = new RCron()
  await cron.init()

example

    /*
    > cron
    Cron(0) [
      password: 'redis',
      db: 15,
      port: 6379,
      host: '127.0.0.1',
      family: 4,
      redis: RD {
        family: 4,
        host: '127.0.0.1',
        port: 6379,
        password: 'redis',
        db: 15,
        one_time_task_noti_handler: [AsyncFunction (anonymous)]
      },
      standard_clock: Auto [2022-05-12 18:18:30.630 +0800] {},
      freq: 1000
    ]
    >
    > cron.event_clock_
    Manual [2022-05-12 18:18:57.764 +0800] {}
    > cron.standard_clock
    Auto [2022-05-12 18:19:19.961 +0800] {}
    >

    */

    /*
    > cron.add_xsec_tsk("every_10sec_tsk0",10,(D,tsk_self)=>{console.log(D)})
    <ref *1> _Task {
      name: 'every_10sec_tsk0',
      idx: 0,
      cond_func: [Function: cond_func],
      exec_func: [Function (anonymous)],
      cron: Cron(1) [
        [Circular *1],
        password: 'redis',
        db: 15,
        port: 6379,
        host: '127.0.0.1',
        family: 4,
        redis: RD {
          family: 4,
          host: '127.0.0.1',
          port: 6379,
          password: 'redis',
          db: 15,
          one_time_task_noti_handler: [AsyncFunction (anonymous)]
        },
        standard_clock: Auto [2022-05-12 18:21:17.048 +0800] {},
        freq: 1000
      ],
      ready_mts: 1652350874764,
      last_exec_date: null,
    }
    >

    */


    //every 10 seconds
    var tsk = cron.add_xsec_tsk("every_10sec_tsk0",10,(D,tsk_self)=>{console.log(D)});

    /*
    >
    > {
      y: 2022,
      m: 5,
      d: 12,
      h: 18,
      min: 32,
      s: 46,
      ms: 266,
      ts: 1652351566.266,
      mts: 1652351566266,
      zone: '+0800',
      soffset: 28800,
      msoffset: 28800000,
      utc_wd: 4,
      lcl_wd: 5
    }

    > {
      y: 2022,
      m: 5,
      d: 12,
      h: 18,
      min: 32,
      s: 56,
      ms: 266,
      ts: 1652351576.266,
      mts: 1652351576266,
      zone: '+0800',
      soffset: 28800,
      msoffset: 28800000,
      utc_wd: 4,
      lcl_wd: 5
    }

    > {
      y: 2022,
      m: 5,
      d: 12,
      h: 18,
      min: 33,
      s: 6,
      ms: 266,
      ts: 1652351586.266,
      mts: 1652351586266,
      zone: '+0800',
      soffset: 28800,
      msoffset: 28800000,
      utc_wd: 4,
      lcl_wd: 5
    }


    */

    /*
    > cron
    <ref *1> Cron(1) [
      _Task {
        name: 'every_10sec_tsk0',
        idx: 0,
        cond_func: [Function: cond_func],
        exec_func: [Function (anonymous)],
        cron: [Circular *1],
        ready_mts: 1652351638622,
        last_exec_date: null
      },
      password: 'redis',
      db: 15,
      port: 6379,
      host: '127.0.0.1',
      family: 4,
      redis: RD {
        family: 4,
        host: '127.0.0.1',
        port: 6379,
        password: 'redis',
        db: 15,
        one_time_task_noti_handler: [AsyncFunction (anonymous)]
      },
      standard_clock: Auto [2022-05-12 18:34:07.391 +0800] {},
      freq: 1000
    ]

    */
    tsk.erase()

    /*
    > cron
    Cron(0) [
      password: 'redis',
      db: 15,
      port: 6379,
      host: '127.0.0.1',
      family: 4,
      redis: RD {
        family: 4,
        host: '127.0.0.1',
        port: 6379,
        password: 'redis',
        db: 15,
        one_time_task_noti_handler: [AsyncFunction (anonymous)]
      },
      standard_clock: Auto [2022-05-12 18:34:23.027 +0800] {},
      freq: 1000
    ]
    >

    */



    var tsk = cron.add_tsk(
        "run at roughly 7 secs between 18:00 to 19:00",
        (D,tsk_self) =>  (D.s % 7 === 0) && (D.h>=18 && D.h < 19),
        (D,tsk_self)=> {
            console.log(new Date)
        }
    );


    /*
    > 2022-05-12T10:41:59.636Z
    2022-05-12T10:42:03.649Z
    2022-05-12T10:42:10.675Z
    2022-05-12T10:42:17.695Z
    2022-05-12T10:42:24.715Z
    2022-05-12T10:42:31.737Z
    2022-05-12T10:42:38.761Z

    */

METHODS

cfg

  cron.db                    cron.family                cron.freq                  cron.host                  cron.length                cron.password              cron.port                  cron.redis

clock

 cron.standard_clock
 cron.event_clock_
 cron.mts_
 cron.adjust_clock

    async cron.init()
    async cron.stop()
    cron.tsk(name)
                        

   cron.add_tsk


   cron.add_friday_tsk        cron.add_mANDd_tsk         cron.add_monday_tsk        cron.add_msANDds_tsk       cron.add_nst_day_tsk       cron.add_nst_month_tsk     cron.add_saturday_tsk      cron.add_sunday_tsk
   cron.add_thursday_tsk      cron.add_tsk               cron.add_tuesday_tsk       cron.add_wd_tsk            cron.add_wensday_tsk       cron.add_workday_tsk       cron.add_xday_tsk          cron.add_xhour_tsk
   cron.add_xmin_tsk          cron.add_xsec_tsk          cron.add_xweak_tsk                

LICENSE

  • ISC