Giter Club home page Giter Club logo

heroku-self-ping's Introduction

Heroku self ping

To avoid the one-hour time limit on your dyno, use this npm module:

require('heroku-self-ping')("http://your-app-url");

This will register a timer self-pinging your app every 20 minutes.

This timer will only activate when your app is running on Heroku platform. The script is a no-op on any other environment, including local and CI.

Parameters

  • your-app-url can be any URL to access your app -- an herokuapp.com subdomain or any custom domain defined with your app.

Heroku doesn't allow an app to retrieve its current name, which is why you need to manually specify the URL.

  • options, optional object with the following keys:
    • interval number of ms between two heartbeats calls. Default to 20 * 60 * 1000 (20 minutes).
    • logger function to use for logging. Default to console.log
    • verbose send more information to logger function. Default to false.

Return

The function returns an interval id when running on Heroku and the URL is not falsy, and false in other cases.

Usage

We recommend you set a custom env variable, for instance heroku config:set APP_URL http://yourapp.herokuapp.com and access it later from process.env.APP_URL.

The lib won't do anything when passed an empty url.

heroku-self-ping's People

Contributors

neamar avatar amoki avatar akameco avatar

Watchers

James Cloos avatar Oran Moshe avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.