fix(retry): resolve message delivery speed
fix(retry): resolve message delivery speed
This commit is contained in:
@@ -716,6 +716,10 @@ export function createConnectionCircuitBreaker(customOptions?: Partial<CircuitBr
|
||||
resetTimeout: 60000,
|
||||
successThreshold: 1,
|
||||
shouldCountError: (error: Error) => {
|
||||
// CircuitTimeoutError messages embed the circuit name (e.g. "socket-query"), which
|
||||
// accidentally matches the "socket" pattern below and causes a self-reinforcing loop
|
||||
// where the breaker's own timeouts keep tripping the breaker. Exclude them explicitly.
|
||||
if (error instanceof CircuitTimeoutError) return false
|
||||
const message = error.message.toLowerCase()
|
||||
const code = (error as NodeJS.ErrnoException).code?.toLowerCase() || ''
|
||||
return connectionErrorPatterns.some(pattern => message.includes(pattern) || code.includes(pattern))
|
||||
|
||||
@@ -174,7 +174,13 @@ export class MessageRetryManager {
|
||||
// (device suffix present/absent, LID vs PN, etc.)
|
||||
const indexedKeyStr = this.messageKeyIndex.get(id)
|
||||
if (indexedKeyStr) {
|
||||
return this.recentMessagesMap.get(indexedKeyStr)
|
||||
const message = this.recentMessagesMap.get(indexedKeyStr)
|
||||
if (!message) {
|
||||
// The LRU cache evicted this entry; clean up the stale index reference
|
||||
// to prevent repeated futile lookups on subsequent retry receipts.
|
||||
this.messageKeyIndex.delete(id)
|
||||
}
|
||||
return message
|
||||
}
|
||||
|
||||
return undefined
|
||||
|
||||
Reference in New Issue
Block a user