Delay in sending data after every 100th request #212
-
We are currently working on project which uses ESP32S and Firebase Realtime Database. The issue we are facing is after every 100th update request there is a slight delay of around 2-3sec. We are attaching the reproduced sample code and the output of it showing the issue. Sample CODE: #include <WiFi.h> //Provide the RTDB payload printing info and other helper functions. /* 1. Define the WiFi credentials */ //For the following credentials, see examples/Authentications/SignInAsUser/EmailPassword/EmailPassword.ino /* 2. Define the API Key */ /* 3. Define the RTDB URL */ /* 4. Define the user Email and password that alreadey registerd or added in
//Define Firebase Data object unsigned long start_time = 0; void setup() Serial.begin(115200); WiFi.begin(WIFI_SSID, WIFI_PASSWORD); Serial.printf("Firebase Client v%s\n\n", FIREBASE_CLIENT_VERSION); /* Assign the api key (required) */ /* Assign the user sign in credentials */ /* Assign the RTDB URL (required) */ /* Assign the callback function for the long running token generation task */ //Or use legacy authenticate method Firebase.begin(&config, &auth); Firebase.reconnectWiFi(true); } void loop() json.set("/int",count);
//fbdo.clear(); } OUTPUT of monitor: Here you can see the delay after 100th update.. this is a repetitive pattern. So the next big delay will be at 202,303,404,.. and so on. We tried updating the libraries and SDK. Can you please help me with this :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
All async functions are not anyc call but sending the request without waiting for response or ignore the response. The client receive buffer may full or sever denied the further request can be occurred at some subsequence requests, then the current session will close and start new connection which required the time for SSL handshake to be done in almost second. The purpose of async functions is for sending data rapidly in case of speed is important but not doing this all the time as it runs in loop without timing. Use normal function instead of async function for your general use. |
Beta Was this translation helpful? Give feedback.
All async functions are not anyc call but sending the request without waiting for response or ignore the response.
The client receive buffer may full or sever denied the further request can be occurred at some subsequence requests, then the current session will close and start new connection which required the time for SSL handshake to be done in almost second.
The purpose of async functions is for sending data rapidly in case of speed is important but not doing this all the time as it runs in loop without timing.
Use normal function instead of async function for your general use.