I have a Cloud Functions, which triggers if a certain value in my Realtime Database changes. After that I need to read an other value from the Database.
I searched the web and found one solution. It worked: The function triggered as soon as the value at /ID/temp_id changed, but it took additional 5 seconds to read the value at /ID/I.
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
exports.getID = functions.database.ref("/ID/temp_id").onUpdate((change, context)=>{ //triggers the function when value "temp_id" changes
const tempID = change.after.val();
const i_snap = admin.database().ref("/ID/i").once("value", function(snapshot){ //read the value at "/ID/i" from the databse
const i = snapshot.val();
})
})
Is there any way to read the value at /ID/I faster?