Commit 5c87f89
committed
Fix: always update the most recent help status
The message cache does not have a stable order (I suspect it is simply
the order in which the messages were added to the cache). Thus, when
searching for the latest status message, sometimes a message other than
the latest was picked.
In practice, it seems like this only ever happened when the bot was
offline for a number of hours, which is why it hasn't come up in
production. But in development, it could be reproduced by:
- Leave the bot offline for a while (24h?)
- Start the bot
- Claim a channel
- The channel that is moved up from being dormant has the wrong message
edited, so the message at the bottom still says "dormant".
I suspect this is what the `.reverse()`, which was removed in commit
09ad491, was intended to solve (but it
caused bugs during normal operation). This should be a full fix.
I am not sure of the performance implications here. I think it should
not be too bad, because we are filtering to only messages from the bot,
before sorting.1 parent 17acc24 commit 5c87f89
1 file changed
+4
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
346 | 346 | | |
347 | 347 | | |
348 | 348 | | |
| 349 | + | |
| 350 | + | |
349 | 351 | | |
350 | 352 | | |
351 | 353 | | |
| 354 | + | |
352 | 355 | | |
353 | 356 | | |
354 | 357 | | |
| 358 | + | |
355 | 359 | | |
356 | 360 | | |
357 | 361 | | |
| |||
0 commit comments