File tree 2 files changed +11
-1
lines changed 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -50,3 +50,7 @@ USERS_CHECK_TIMEOUT = 1800
50
50
USERS_BATCH_SIZE = 500
51
51
# # Set to 1 to disable this check at boot
52
52
DISABLE_SANITY_CHECK = 0
53
+
54
+ # Disable streams completely.
55
+ # This is only meant for debugging purposes and will make QTweet non-functional to most users.
56
+ DISABLE_STREAMS = 0
Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ const tClient = new Twitter({
32
32
access_token_secret : process . env . TWITTER_ACCESS_TOKEN_SECRET ,
33
33
} ) ;
34
34
35
+ const DISABLE_STREAMS = ! ! Number ( process . env . DISABLE_STREAMS ) ;
36
+
35
37
const reconnectionDelay = new Backup ( {
36
38
mode : 'exponential' ,
37
39
startValue : 2000 ,
@@ -447,7 +449,11 @@ export const createStream = async () => {
447
449
log ( 'No user IDs, no need to create a stream...' ) ;
448
450
return null ;
449
451
}
450
- stream . create ( userIds . map ( ( { twitterId } ) => twitterId ) ) ;
452
+ if ( ! DISABLE_STREAMS ) {
453
+ stream . create ( userIds . map ( ( { twitterId } ) => twitterId ) ) ;
454
+ } else {
455
+ log ( 'ATTENTION: the DISABLE_STREAMS variable is set, meaning streams are currently not being created!' ) ;
456
+ }
451
457
return null ;
452
458
} ;
453
459
You can’t perform that action at this time.
0 commit comments