Skip to content

Commit

Permalink
upd
Browse files Browse the repository at this point in the history
  • Loading branch information
wakirin committed Sep 26, 2024
1 parent 9cf990b commit 1ed5312
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions middleware/pingprophet/integrations/PingprophetMNP.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,20 +252,15 @@ async def patch_contacts(self, pp_request):
response = requests.post(f"{os.getenv('COMM_URL')}/api/v1/contacts/upsert", json=req, headers=headers)
self.logger.info("Contact patch response (team id: %s), Response: %s", pp_request['team_id'],
response.json())
placeholders = ', '.join(':id' + str(i) for i in range(len(ids)))
placeholders = ", ".join([f":id{i}" for i in range(len(ids))])
values = {f"id{i}": id for i, id in enumerate(ids)}

if response.status_code != 200:
query = "update ping_prophet_mnp_results set status = 'failed' where id in ({placeholders});"
values = {
f"id{i}": id for i, id in enumerate(ids)
}
query = f"update ping_prophet_mnp_results set status = 'failed' where id in ({placeholders})"
await self.db.execute(query, values)
continue

query = f"update ping_prophet_mnp_results set status = 'completed' where id in ({placeholders});"
values = {
f"id{i}": id for i, id in enumerate(ids)
}
query = f"update ping_prophet_mnp_results set status = 'completed' where id in ({placeholders})"
await self.db.execute(query, values)

await asyncio.sleep(1)
Expand Down

0 comments on commit 1ed5312

Please sign in to comment.