Skip to content

Commit

Permalink
fix more prefix garbage
Browse files Browse the repository at this point in the history
  • Loading branch information
DGaffney committed Oct 12, 2023
1 parent 3c400b2 commit 22599f9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 3 additions & 1 deletion lib/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from lib.logger import logger
from lib import schemas
from lib.sentry import sentry_sdk
from lib.helpers import get_setting, get_environment_setting

app = FastAPI()

Expand All @@ -31,8 +32,9 @@ async def post_url(url: str, params: dict) -> Dict[str, Any]:
@app.post("/process_item/{process_name}")
def process_item(process_name: str, message: Dict[str, Any]):
logger.info(message)
queue_prefix = get_setting("", "QUEUE_PREFIX").replace(".", "__")
queue = QueueWorker.create(process_name)
queue.push_message(process_name, schemas.Message(body=message))
queue.push_message(f"{queue_prefix}{process_name}", schemas.Message(body=message))
return {"message": "Message pushed successfully", "queue": process_name, "body": message}

@app.post("/trigger_callback")
Expand Down
5 changes: 2 additions & 3 deletions lib/queue/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import boto3
import botocore

from lib.helpers import get_setting, get_environment_setting
from lib.helpers import get_environment_setting
from lib.logger import logger
from lib import schemas
SQS_MAX_BATCH_SIZE = 10
Expand Down Expand Up @@ -154,6 +154,5 @@ def push_message(self, queue_name: str, message: schemas.Message) -> schemas.Mes
"""
Actual SQS logic for pushing a message to a queue
"""
queue_prefix = get_setting("", "QUEUE_PREFIX").replace(".", "__")
self.find_queue_by_name(f"{queue_prefix}{queue_name}").send_message(MessageBody=json.dumps(message.dict()))
self.find_queue_by_name(queue_name).send_message(MessageBody=json.dumps(message.dict()))
return message

0 comments on commit 22599f9

Please sign in to comment.