Skip to content

Commit

Permalink
Add a sleep time of 1s to request manager worker thread.
Browse files Browse the repository at this point in the history
  • Loading branch information
aussig committed Aug 13, 2023
1 parent c957846 commit 20b8ab0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions bgstally/requestmanager.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
from queue import Queue
from re import IGNORECASE, compile, match
from threading import Thread
from time import sleep

import requests
from requests import Response
from re import compile, match, IGNORECASE

import config

from bgstally.constants import RequestMethod
from bgstally.debug import Debug

TIME_WORKER_PERIOD_S = 1
TIMEOUT_S = 10


Expand Down Expand Up @@ -83,6 +84,12 @@ def _worker(self) -> None:
Debug.logger.debug("Starting Request Worker...")

while True:
if config.shutting_down:
Debug.logger.debug("Shutting down RequestManager Worker...")
return

sleep(TIME_WORKER_PERIOD_S)

# Fetch from the queue. Blocks indefinitely until an item is available.
request:BGSTallyRequest = self.request_queue.get()

Expand Down

0 comments on commit 20b8ab0

Please sign in to comment.