limit wall-of-text log spam for fetch fallback on network outage #kornwolf

would you be willing to share details on how you solved this problem?

travel vlogger & single mother

I use RxJS. Upon every error, rather than making n calls to 'log', I just emit them as a stream of errors. Elsewhere I buffer them together (using 'window' operator) in blocks of 5 seconds and only produce a single 'aggregate log call' for the similar 'incidents'.

If hundreds of those individual network requests suddenly fail, with the same error code and within the same (small) time frame, then I make the assumption that they're probably related. I then just log it as one 'general problem', saying 'xx fetches failed: ENOTFOUND'. This aggregation keeps the log spam down, while still recording the events. I use

RxJS lets you decouple the 'event source' from the 'handling'. It allows for such kinds of deferred fanciness.