discord.js occasionally resending requests, causing double messages
I've got a feature which sends a message at 00:00:00. However, sometimes requests are sent twice or even three times. This doesn't affect only messages, a PUT Guild Member request was also re-send once.
I'm quite sure this isn't a code issue, and it might very well not be related to djs (probably just too many network requests at that time).
T+194: Discord assigns a snowflake to M1 (probably near the sent timestamp in the channel)
T+302: Guild Member request is sent P1
T+15_002: Birthday message request M1 fails; without status, headers and body*; djs resends it M2
T+15_303: Guild Member request P1 fails, same response as above; djs resends it P2
T+15_364: Discord assigns a snowflake to either P1 or P2
T+15_458: Guild Member request triggers a Guild Member update event (either P1 or P2)
T+15_673: Discord assigns a snowflake to M2
T+16_012: HTTP 200 and message body returned for M2
T+16_224: HTTP 204 returned for P2
*: probably a network error? I'm currently unable to log those with my hack-ish request logging
So, what's causing djs to retry requests, or is this unrelated to djs and done at undici level or below?
Version: discord.js@14.15.3-dev.1716595781-a468ae8bb (not latest, tho it happened four months ago already so unlikely to be a recent issue)
I'm quite sure this isn't a code issue, and it might very well not be related to djs (probably just too many network requests at that time).
Sample Timeline (ms)
T+0: djs correctly sends the Birthday message request M1T+194: Discord assigns a snowflake to M1 (probably near the sent timestamp in the channel)
T+302: Guild Member request is sent P1
T+15_002: Birthday message request M1 fails; without status, headers and body*; djs resends it M2
T+15_303: Guild Member request P1 fails, same response as above; djs resends it P2
T+15_364: Discord assigns a snowflake to either P1 or P2
T+15_458: Guild Member request triggers a Guild Member update event (either P1 or P2)
T+15_673: Discord assigns a snowflake to M2
T+16_012: HTTP 200 and message body returned for M2
T+16_224: HTTP 204 returned for P2
*: probably a network error? I'm currently unable to log those with my hack-ish request logging
Main issue
Despite the requests failing to return a proper response, causing djs to resend them, they are processed correctly on Discords end. This doesn't really matter for e.g. Guild Member updates, but messages being sent two or three times is just annoying.So, what's causing djs to retry requests, or is this unrelated to djs and done at undici level or below?
Version: discord.js@14.15.3-dev.1716595781-a468ae8bb (not latest, tho it happened four months ago already so unlikely to be a recent issue)