2

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.

KENdi
  • 7,576
  • 2
  • 16
  • 31
  • Have you found any solution ? – Tushar Sheth Aug 03 '17 at 05:03
  • @TusharSheth Well at that time Google just added quotas on DNS resolutions and each firebase database request triggers a DNS resolution. In my case I do a lot of them. I requested a higher quota and everything came back to normal (3 weeks later ;)) – Maxime Bouré Aug 04 '17 at 07:57
  • 1
    My userbase is only 1000 . And also have DNS resolution quota problem but there is no DNS query in code. Hope someone can help – Superbiji Aug 26 '17 at 01:43

0 Answers0