Skip to content

Commit

Permalink
Merge pull request #466 from rollbar/fix-global-config
Browse files Browse the repository at this point in the history
Fix global config
  • Loading branch information
rokob authored Oct 17, 2017
2 parents 0af1bb8 + 2d40b94 commit a3cdf8d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion examples/universal-browser/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ const app = express();

app.use(express.static(path.join(__dirname)));
app.get('/rollbar.js', function response(req, res) {
res.sendFile(path.join(__dirname, '../../dist/rollbar.umd.js'))
var t = (req.query.t || 0.01) * 100;
console.log("Waiting: ", t, "ms");
setTimeout(function() {
res.sendFile(path.join(__dirname, '../../dist/rollbar.umd.js'))
}, t);
});

app.get('/test', function response(req, res) {
Expand Down
2 changes: 1 addition & 1 deletion src/rateLimiter.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ RateLimiter.prototype.setPlatformOptions = function(platform, options) {
/* Helpers */

function checkRate(item, limit, counter) {
return !item.ignoreRateLimit && limit >= 1 && counter >= limit;
return !item.ignoreRateLimit && limit >= 1 && counter > limit;
}

function shouldSendValue(platform, options, error, shouldSend, globalRateLimit) {
Expand Down
2 changes: 2 additions & 0 deletions src/rollbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var _ = require('./utility');
function Rollbar(options, api, logger, platform) {
this.options = _.extend(true, {}, options);
this.logger = logger;
Rollbar.rateLimiter.configureGlobal(this.options);
Rollbar.rateLimiter.setPlatformOptions(platform, this.options);
this.queue = new Queue(Rollbar.rateLimiter, api, logger, this.options);
this.notifier = new Notifier(this.queue, this.options);
Expand Down Expand Up @@ -42,6 +43,7 @@ Rollbar.prototype.configure = function(options, payloadData) {
payload = {payload: payloadData};
}
this.options = _.extend(true, {}, oldOptions, options, payload);
this.global(this.options);
return this;
};

Expand Down

0 comments on commit a3cdf8d

Please sign in to comment.