Skip to content

Instantly share code, notes, and snippets.

@joemccann
Last active August 20, 2018 17:10
Show Gist options
  • Save joemccann/626fb65255804e5fc8e50e295aa1fdf2 to your computer and use it in GitHub Desktop.
Save joemccann/626fb65255804e5fc8e50e295aa1fdf2 to your computer and use it in GitHub Desktop.

Revisions

  1. joemccann revised this gist Aug 20, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions now-poller.js
    Original file line number Diff line number Diff line change
    @@ -10,8 +10,8 @@ function main() {

    schedule.scheduleJob('* * * * *', async () => {
    const urls = [
    `https://crypto-analytics-bot-nolygdkjvt.now.sh/`,
    `https://api-gxijwgqiom.now.sh/_health`
    `https://XXX.now.sh/`,
    `https://YYY.now.sh/`
    ]
    for (let url of urls) {
    try {
  2. joemccann created this gist Aug 20, 2018.
    29 changes: 29 additions & 0 deletions now-poller.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    const tiny = require('tiny-json-http')
    const schedule = require('node-schedule')

    const {
    error,
    log
    } = console

    function main() {

    schedule.scheduleJob('* * * * *', async () => {
    const urls = [
    `https://crypto-analytics-bot-nolygdkjvt.now.sh/`,
    `https://api-gxijwgqiom.now.sh/_health`
    ]
    for (let url of urls) {
    try {
    const ping = await tiny.get({
    url
    })
    log(`Status: ${ping.body.status} | Timestamp: ${ping.body.timestamp}`)
    } catch (e) {
    error(e)
    }
    }
    })
    }

    main()