mirror of
https://github.com/tulir/mautrix-whatsapp
synced 2024-12-14 17:33:48 +01:00
Add a warning log and more comments
This commit is contained in:
parent
44768c9c93
commit
2542f94e00
2 changed files with 4 additions and 0 deletions
|
@ -284,8 +284,10 @@ bridge:
|
||||||
# Null means there's no enforced timeout.
|
# Null means there's no enforced timeout.
|
||||||
message_handling_timeout:
|
message_handling_timeout:
|
||||||
# Send an error message after this timeout, but keep waiting for the response until the deadline.
|
# Send an error message after this timeout, but keep waiting for the response until the deadline.
|
||||||
|
# This is counted from the origin_server_ts, so the warning time is consistent regardless of the source of delay.
|
||||||
error_after: 10s
|
error_after: 10s
|
||||||
# Drop messages after this timeout. They may still go through if the message got sent to the servers.
|
# Drop messages after this timeout. They may still go through if the message got sent to the servers.
|
||||||
|
# This is counted from the time the bridge starts handling the message.
|
||||||
deadline: 60s
|
deadline: 60s
|
||||||
|
|
||||||
# The prefix for commands. Only required in non-management rooms.
|
# The prefix for commands. Only required in non-management rooms.
|
||||||
|
|
|
@ -3156,6 +3156,8 @@ func (portal *Portal) HandleMatrixMessage(sender *User, evt *event.Event) {
|
||||||
if remainingTime < 0 {
|
if remainingTime < 0 {
|
||||||
go ms.sendMessageMetrics(evt, fmt.Errorf("%w (message is %s old)", errTimeoutBeforeHandling, messageAge), "Timeout handling", true)
|
go ms.sendMessageMetrics(evt, fmt.Errorf("%w (message is %s old)", errTimeoutBeforeHandling, messageAge), "Timeout handling", true)
|
||||||
return
|
return
|
||||||
|
} else if remainingTime < 1*time.Second {
|
||||||
|
portal.log.Warnfln("Message %s was delayed before reaching the bridge, only have %s (of %s timeout) until delay warning", evt.ID, remainingTime, portal.bridge.Config.Bridge.MessageHandlingTimeout.ErrorAfter)
|
||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
time.Sleep(remainingTime)
|
time.Sleep(remainingTime)
|
||||||
|
|
Loading…
Reference in a new issue