guardian / mobile-n10n

n10n for nOTIFICATIOn
Apache License 2.0
26 stars 4 forks source link

Add timeout to HTTP requests to Firebase API in Android sender lambda #1233

Closed waisingyiu closed 5 months ago

waisingyiu commented 5 months ago

What does this change?

We notice that occasionally the Firebase API returns an internal error of service unavailable and then our Android sender lambda appears to stop working until it is terminated due to timeout:

Screenshot 2024-05-16 at 13 38 45 Screenshot 2024-05-16 at 13 39 37

It appears that the lambda may be waiting for responses from Firebase API who may have become unavailable.

At the moment, we do not set any timeout configuration for requests we send to Firebase API. According to API doc, the HTTP client waits indefinitely for responses by default.

This PR adds configurable parameters (fcm.connectTimeout and fcm.requestTimeout) to set the timeout (in seconds) of making HTTP connections and waiting for responses.

We did a sanity test on CODE and we were able to receive notification via Android simulator.