feat: Improve processing speed by increase Rabbit fetch count
This commit is contained in:
@@ -13,6 +13,7 @@ from src.messages import AnalyzeResponse
|
||||
|
||||
BATCH_SIZE = 100
|
||||
RABBIT_CONSUME_TIMEOUT = 4
|
||||
PREFETCH_COUNT = 20 # only one consumer and quick processing -> can be big
|
||||
|
||||
|
||||
def get_user_id(session, name: str):
|
||||
@@ -114,11 +115,11 @@ def process_task_replies(session, channel, consume_count: int):
|
||||
def main():
|
||||
consume_count = 0 if len(sys.argv) == 1 else int(sys.argv[1])
|
||||
session = DBSession()
|
||||
channel = get_channel()
|
||||
channel = get_channel(prefetch_count=PREFETCH_COUNT)
|
||||
try:
|
||||
process_repositories(session=session, channel=channel, consume_count=consume_count)
|
||||
channel.close()
|
||||
channel = get_channel()
|
||||
channel = get_channel(prefetch_count=PREFETCH_COUNT)
|
||||
process_task_replies(session=session, channel=channel, consume_count=consume_count)
|
||||
finally:
|
||||
session.commit()
|
||||
|
||||
Reference in New Issue
Block a user