-
Notifications
You must be signed in to change notification settings - Fork 3.9k
fix: Deadlock errors and undefined arguments #1473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…an INT4 (32-bit signed integer. ## Solução Após analise dos valores recebidos e seguindo a logica em outras partes também, se confirma que o valor de entrada é de timestamp em ms.
## Erros: - code: "40P01", message: "deadlock detected". - Argument status is missing.
## Erros: - Cannot read properties of null (reading 'fileName')
Reviewer's GuideThis PR implements an in-memory deduplication cache across WhatsApp message workflows to prevent simultaneous processing deadlocks, standardizes timestamp values by converting from milliseconds to seconds, and restructures message handling to avoid inserting undefined values, while also refining the Chatwoot import helper and adjusting logging behavior. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
@DavidsonGomes Esses problemas vim detectando em um cliente com mais de 10 instancias/ 20 mil msgs desde Abril e vim aplicando na 2.2.3 e testando. Também apliquei em um cliente com mais de 5 mil msgs por dia. |
@sourcery-ai review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @KokeroO - I've reviewed your changes - here's some feedback:
- There’s a lot of repeated cache key generation and get/set logic — consider extracting that into a small helper to DRY up the code and reduce duplication.
- Instead of throwing bare strings like ‘The message is messageContextInfo’, throw proper Error objects to preserve stack traces and ensure consistent error handling.
- Converting
fromMe
to a string for the cache key could be brittle; consider using a consistent boolean or number representation to avoid unexpected key collisions.
Here's what I looked at during the review
- 🟡 General issues: 3 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts
Outdated
Show resolved
Hide resolved
src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts
Outdated
Show resolved
Hide resolved
src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts
Outdated
Show resolved
Hide resolved
@sourcery-ai review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @KokeroO - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Descrição
Este PR corrige diversos problemas relacionados a deadlocks causados por mensagens upsert e update que chegam duplicadas e são processadas simultaneamente pelo script, resultando em conflitos no banco de dados.
Também soluciona falhas ao tentar inserir determinados valores no banco.
Soluções
undefined
a certas propriedades de forma indevida.Summary by Sourcery
Implement in-memory caching to prevent deadlocks from duplicate message processing, convert timestamps to seconds, and enforce null-safe handling of message types and payloads in WhatsApp and Chatwoot integrations
Bug Fixes:
Enhancements: