Skip to content

Commit

Permalink
Merge pull request #287 from RichLuna/configurable_pulling_time
Browse files Browse the repository at this point in the history
Polling time now can be configured in the .rainbow_config.json file
  • Loading branch information
orakaro authored Jan 25, 2022
2 parents aa0cb0c + 1fc6ff3 commit 8b2efa5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@ If you would like to specify a different location for your custom config you can

You also can view or set a new value of every config key with the ``config`` command (See **Interactive mode** section above).

- ``POLLING_TIME``: Time in seconds between each automatic poll. Most Twitter accounts have a limit of 15 requests each 15 minutes. If in doubt, set it to 90 or more.

- ``HEARTBEAT_TIMEOUT``: after this timeout (count by minutes), the stream will automatically hangup.

- ``IMAGE_ON_TERM``: display tweet's image directly on terminal.
Expand Down
2 changes: 2 additions & 0 deletions rainbowstream/colorset/config
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
//Time in seconds between each automatic poll. Most Twitter accounts have a limit of 15 requests each 15 minutes. If in doubt, set it to 90 or more.
"POLLING_TIME" : 90,
// Turn to 'true' in order to disable extended tweets display (legacy mode)
"DISABLE_EXTENDED_TWEETS" : false,
// After 120 minutes, the stream will automatically hangup
Expand Down
2 changes: 1 addition & 1 deletion rainbowstream/rainbow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2211,7 +2211,7 @@ def stream(domain, args, name='Rainbow Stream'):
if args.track_keywords:
query_args['track'] = args.track_keywords

polling_time = 90
polling_time = c['POLLING_TIME']
while True:
time.sleep(polling_time)
poll()
Expand Down

0 comments on commit 8b2efa5

Please sign in to comment.