I have a problem with the DNS resolutions which exceeds quota faster than my functions are called.
I'm using firebase cloud functions to monitor the "connected" status of our users. We update a firebase database field "isLive" on each "onDisconnect" event of our mobile applications. I implemented a Firebase Cloud Function listening to this field. On each call I perform requests to get data from our Firebase Database and update other data, also, from our Firebase Database.
Here is my implementation,
exports.profileIsLive = functions.database.ref("users/{uid}/profile/isLive").onWrite((event) => {
const rootRef = event.data.ref.root;
const uuid = event.params.uid;
const conversationRef = rootRef.child("/users/" + uuid + "/conversations");
return conversationRef.once('value')
.then(snapshot => {
const updates = [];
snapshot.forEach(function (child) {
let conversationId = child.val();
let otherUserUuid = child.key;
let snippetIsLive = "users/" + otherUserUuid + "/conversations/" + conversationId + "/isLive";
updates.push(rootRef.child(snippetIsLive).set(event.data.val()).catch(error => {
return;
}));
let participantIsLive = "conversations/" + conversationId + "/participants/" + uuid + "/isLive";
updates.push(rootRef.child(participantIsLive).set(event.data.val()).catch(error => {
return;
}));
if (!event.data.val()) {
let participantLastSeen = "conversations/" + conversationId + "/participants/" + uuid + "/lastSeen";
updates.push(rootRef.child(participantLastSeen).set(admin.database.ServerValue.TIMESTAMP).catch(error => {
return;
}));
}
});
return Promise.all(updates);
});
});
I don't see why I have DNS resolutions here. Is there a resolution on each call to the Firebase Database ? If so why the DNS resolution quota is set to 4000 where we can have millions of calls per day ?
Many thanks for any recommandations.