Skip to content
This repository was archived by the owner on Feb 13, 2018. It is now read-only.

Commit ad9ebd9

Browse files
author
Tim Whitlock
committed
Merge pull request #7 from franciscod/master
ratelimit example: fix remaining requests check, had inverted logic
2 parents ddb8c35 + 44745b5 commit ad9ebd9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

examples/rate-limits.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ var client = require('../lib/twitter').createClient();
66

77
client.setAuth (
88
'your consumer key',
9-
'your consumer secret',
9+
'your consumer secret',
1010
'some access key',
11-
'some access secret'
11+
'some access secret'
1212
);
1313

1414

@@ -25,11 +25,11 @@ function nextPage(){
2525
else {
2626
console.log('OK: '+cursor+' -> '+page.ids.length+' followers' );
2727
cursor = page.next_cursor_str;
28-
28+
2929
var limit = client.getRateLimit();
3030
if( limit ){
3131
var remaining = client.getRateLimitRemaining();
32-
if( remaining ){
32+
if( !remaining ){
3333
console.log( 'No requests left. Next call will throw 429 .. you\'ll see' );
3434
}
3535
else {
@@ -40,4 +40,4 @@ function nextPage(){
4040
}
4141
} );
4242
}
43-
nextPage();
43+
nextPage();

0 commit comments

Comments
 (0)