Comparing version 0.0.3 to 0.0.4
{ | ||
"name": "ft-poller", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"repository": { | ||
@@ -10,3 +10,3 @@ "type": "git", | ||
"description": "An http client to periodically fetch and cache data from web services", | ||
"main": "./src/poller.js", | ||
"main": "./src/server.js", | ||
"directories": { | ||
@@ -13,0 +13,0 @@ "lib": "./lib" |
Scheduled, async content fetching for Node.js applications. | ||
Scheduled, asynchronous JSON fetching for Node.js applications. | ||
@@ -22,8 +22,8 @@ ### Background | ||
Firstly, your response is dependent on the slowest service to respond. If every | ||
request is hanging around waiting for 'the slow one' you are going only ever | ||
going to perform at the slowest speed. | ||
request is hanging around waiting for 'the slow one' your performance is pegged | ||
to the worst performing part of your application. | ||
Secondly, by far the slowest thing in this type of architecture is the | ||
roundtrip between the presentation tier and the service(s). The more of these | ||
you have hanging around, waiting for connections to close, the greater the | ||
round-trip between the presentation tier and the service(s). The more of these | ||
open connections you have hanging around, waiting to close, the greater the | ||
burden you place on your server. | ||
@@ -45,2 +45,6 @@ | ||
This pattern (of asynchronous fetching) allows the presentation tier to focus on | ||
building a response from existing data (in memory) and sending it back out the | ||
front door as quickly as possible. | ||
### Usage | ||
@@ -54,3 +58,3 @@ | ||
// Nb. do `npm install es6-promise` if running node < 10.x | ||
// Nb. do `npm install es6-promise` if running node < 11.x | ||
GLOBAL.Promise = require('es6-promise').Promise; | ||
@@ -88,3 +92,3 @@ | ||
p.start({ initialRefresh: true }); | ||
p.start({ initialRequest: true }); | ||
@@ -91,0 +95,0 @@ ### Events |
@@ -5,4 +5,2 @@ 'use strict'; | ||
var superPromise = require('superagent-promises'); | ||
var events = require('events'); | ||
var util = require('util'); | ||
@@ -16,4 +14,2 @@ var Poller = function(config) { | ||
util.inherits(Poller, events.EventEmitter); | ||
Poller.prototype.isRunning = function () { | ||
@@ -20,0 +16,0 @@ return !!this.poller; |
@@ -5,3 +5,3 @@ | ||
var chai = require('chai'), | ||
Poller = require('../src/poller'), | ||
Poller = require('../src/server'), | ||
sinon = require('sinon'), | ||
@@ -45,3 +45,3 @@ nock = require('nock'), | ||
new Poller( { | ||
var p = new Poller( { | ||
url: 'http://example.com', | ||
@@ -53,3 +53,5 @@ parseData: function (res) { | ||
} | ||
}).fetch(); | ||
}) | ||
p.fetch(); | ||
}); | ||
@@ -56,0 +58,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13729
12
216
116
1