Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

287
Views
¿Cómo darse de baja de observable en Angular en for loop?
const sub1 = this.angularFirestore.collection('Date').doc('username).collection('time').snapshotChanges(); const sub2 = await sub1.subscribe((snapData: DocumentChangeAction<any>[]) => { ` // After each minute, new data is inserted in firebase storage, and the below // code runs automatically, because I have subscribed to it. // now the problem is, after 1 minute, snapData has duplicate records // and for loop is also executed. // method for getting URL from firebase storage, called from below for loop` const send = storageRef => new Promise(resolve => { storageRef.getDownloadURL().then(url => { resolve(url); }, err => { } ); } ); for (const d of snapData) { const storageRef = firebase.storage().ref().child(d.payload.doc.data().timeEachMinute); const ImgUrl = await send(storageRef); this.timestampsList.push({ dateObj: d.payload.doc.data().dateObj, imageUrl: ImgUrl, date: d.payload.doc.data().screenShot, name: d.payload.doc.data().user }); } } sub2.unsubscribe();

Por ejemplo, estoy recuperando 1000 registros, que pueden no completarse en un minuto, supongamos que se recuperan 500 registros, después de un minuto, los nuevos registros comienzan a recuperarse desde el inicio y 501 en adelante, lo que conduce a registros duplicados. Ahora estoy confundido si el problema está en el bucle for o en la suscripción del observador.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!