Commit ddd8e35
authored
Decouple pending HTLC retry from expiry check timer (#11)
Both process_pending_htlcs and handle_expired_htlcs shared a single
5-second sleep, coupling two concerns with very different latency
requirements. Expiry checks are distributed-clock housekeeping where
seconds don't matter. Pending HTLC retries gate payment completion
for serverless SDK clients that reconnect briefly (~20s) during
webhook-driven flows — every extra second of retry latency is a
second the payer is staring at a spinner.
Splitting them into independent select! arms requires switching
from sleep to tokio::time::interval. With sleep, the losing arm
in a select! is cancelled and recreated each iteration — the 1s
pending-HTLC sleep would fire every loop, resetting the 5s expiry
sleep before it ever completes, starving handle_expired_htlcs
entirely. interval maintains its deadline across select! iterations
so both timers tick independently. MissedTickBehavior::Skip avoids
burst catch-up if a handler blocks longer than its interval.1 parent 28ec5c9 commit ddd8e35
1 file changed
Lines changed: 25 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
174 | 187 | | |
175 | 188 | | |
176 | 189 | | |
| |||
625 | 638 | | |
626 | 639 | | |
627 | 640 | | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
628 | 650 | | |
629 | 651 | | |
630 | 652 | | |
| |||
634 | 656 | | |
635 | 657 | | |
636 | 658 | | |
637 | | - | |
| 659 | + | |
638 | 660 | | |
| 661 | + | |
| 662 | + | |
639 | 663 | | |
640 | 664 | | |
641 | 665 | | |
| |||
0 commit comments