(chat database.Chat, now time.Time)
| 2936 | const manualTitleLockStaleAfter = time.Minute |
| 2937 | |
| 2938 | func isFreshManualTitleLock(chat database.Chat, now time.Time) bool { |
| 2939 | if !chat.WorkerID.Valid || chat.WorkerID.UUID != manualTitleLockWorkerID { |
| 2940 | return false |
| 2941 | } |
| 2942 | leaseAt := chat.HeartbeatAt |
| 2943 | if !leaseAt.Valid { |
| 2944 | leaseAt = chat.StartedAt |
| 2945 | } |
| 2946 | return leaseAt.Valid && leaseAt.Time.After(now.Add(-manualTitleLockStaleAfter)) |
| 2947 | } |
| 2948 | |
| 2949 | // updateChatStatusPreserveUpdatedAt applies internal lock transitions without |
| 2950 | // changing chat recency, because chat list ordering uses updated_at. |
no test coverage detected