mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-08-17 02:10:31 +03:00
feat(concurrency): added concurrency for increased performance (#1189)
This commit is contained in:
parent
54a34c2143
commit
2e4fdc80ec
@ -4,8 +4,8 @@
|
||||
{
|
||||
"name": "quivr",
|
||||
"image": "253053805092.dkr.ecr.eu-west-3.amazonaws.com/quivr:bada136312ad3497664c3562a36b263d43c89c53",
|
||||
"cpu": "256",
|
||||
"memory": "1024",
|
||||
"cpu": "1024",
|
||||
"memory": "2048",
|
||||
"portMappings": [
|
||||
{
|
||||
"name": "quivr-5050-tcp",
|
||||
@ -22,7 +22,9 @@
|
||||
"--host",
|
||||
"0.0.0.0",
|
||||
"--port",
|
||||
"5050"
|
||||
"5050",
|
||||
"--workers",
|
||||
"6"
|
||||
],
|
||||
"environment": [],
|
||||
"environmentFiles": [
|
||||
@ -91,8 +93,8 @@
|
||||
"requiresCompatibilities": [
|
||||
"FARGATE"
|
||||
],
|
||||
"cpu": "256",
|
||||
"memory": "1024",
|
||||
"cpu": "1024",
|
||||
"memory": "2048",
|
||||
"runtimePlatform": {
|
||||
"cpuArchitecture": "X86_64",
|
||||
"operatingSystemFamily": "LINUX"
|
||||
|
@ -4,8 +4,8 @@
|
||||
{
|
||||
"name": "quivr",
|
||||
"image": "253053805092.dkr.ecr.eu-west-3.amazonaws.com/quivr:c0ff0301002fe6d043270b26dabcfda797437afc",
|
||||
"cpu": "256",
|
||||
"memory": "1024",
|
||||
"cpu": "1024",
|
||||
"memory": "2048",
|
||||
"portMappings": [
|
||||
{
|
||||
"name": "quivr-5050-tcp",
|
||||
@ -21,7 +21,9 @@
|
||||
"--host",
|
||||
"0.0.0.0",
|
||||
"--port",
|
||||
"5050"
|
||||
"5050",
|
||||
"--workers",
|
||||
"6"
|
||||
],
|
||||
"essential": true,
|
||||
"environment": [],
|
||||
@ -92,8 +94,8 @@
|
||||
"requiresCompatibilities": [
|
||||
"FARGATE"
|
||||
],
|
||||
"cpu": "256",
|
||||
"memory": "1024",
|
||||
"cpu": "1024",
|
||||
"memory": "2048",
|
||||
"runtimePlatform": {
|
||||
"cpuArchitecture": "X86_64",
|
||||
"operatingSystemFamily": "LINUX"
|
||||
|
@ -4,7 +4,7 @@
|
||||
{
|
||||
"name": "quivr-chat",
|
||||
"image": "253053805092.dkr.ecr.eu-west-3.amazonaws.com/quivr:600ff1ede02741c66853cc3e4e7f5001aaba3bc2",
|
||||
"cpu": "256",
|
||||
"cpu": "512",
|
||||
"memory": "1024",
|
||||
"essential": true,
|
||||
"command": [
|
||||
@ -82,7 +82,7 @@
|
||||
"requiresCompatibilities": [
|
||||
"FARGATE"
|
||||
],
|
||||
"cpu": "256",
|
||||
"cpu": "512",
|
||||
"memory": "1024",
|
||||
"runtimePlatform": {
|
||||
"cpuArchitecture": "X86_64",
|
||||
|
@ -4,7 +4,7 @@
|
||||
{
|
||||
"name": "quivr-chat",
|
||||
"image": "253053805092.dkr.ecr.eu-west-3.amazonaws.com/quivr:85ae06c82935028d828f60f35c7e0a47fdee1ff2",
|
||||
"cpu": "256",
|
||||
"cpu": "512",
|
||||
"memory": "1024",
|
||||
"essential": true,
|
||||
"command": [
|
||||
@ -82,7 +82,7 @@
|
||||
"requiresCompatibilities": [
|
||||
"FARGATE"
|
||||
],
|
||||
"cpu": "256",
|
||||
"cpu": "512",
|
||||
"memory": "1024",
|
||||
"runtimePlatform": {
|
||||
"cpuArchitecture": "X86_64",
|
||||
|
@ -31,4 +31,4 @@ RUN pip install --no-cache-dir -r requirements.txt --timeout 200
|
||||
# Copy the rest of the application
|
||||
COPY . .
|
||||
|
||||
CMD ["uvicorn", "main:app", "--reload", "--host", "0.0.0.0", "--port", "5050"]
|
||||
CMD ["uvicorn", "main:app", "--reload", "--host", "0.0.0.0", "--port", "5050", "--workers", "6"]
|
||||
|
@ -28,6 +28,8 @@ if CELERY_BROKER_URL.startswith("sqs"):
|
||||
__name__,
|
||||
broker=CELERY_BROKER_URL,
|
||||
task_serializer="json",
|
||||
task_concurrency=4,
|
||||
worker_prefetch_multiplier=1,
|
||||
broker_transport_options=broker_transport_options,
|
||||
)
|
||||
celery.conf.task_default_queue = CELEBRY_BROKER_QUEUE_NAME
|
||||
@ -36,6 +38,8 @@ elif CELERY_BROKER_URL.startswith("redis"):
|
||||
__name__,
|
||||
broker=CELERY_BROKER_URL,
|
||||
backend=CELERY_BROKER_URL,
|
||||
task_concurrency=4,
|
||||
worker_prefetch_multiplier=1,
|
||||
task_serializer="json",
|
||||
)
|
||||
else:
|
||||
|
@ -116,13 +116,15 @@ class Notifications(Repository):
|
||||
Returns:
|
||||
list[Notification]: The notifications
|
||||
"""
|
||||
five_minutes_ago = datetime.now() - timedelta(minutes=5)
|
||||
five_minutes_ago = (datetime.now() - timedelta(minutes=5)).strftime(
|
||||
"%Y-%m-%d %H:%M:%S.%f"
|
||||
)
|
||||
|
||||
notifications = (
|
||||
self.db.from_("notifications")
|
||||
.select("*")
|
||||
.filter("chat_id", "eq", chat_id)
|
||||
.filter("datetime", "ge", five_minutes_ago)
|
||||
.filter("datetime", "gt", five_minutes_ago)
|
||||
.execute()
|
||||
).data
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user