Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
await this.db.runTransaction(async (t) => {
// Read all workers' metadata and contsruct sharding info based on collected stats.
let query = await t.get(
this.workersRef.orderBy(firestore.FieldPath.documentId())
);
let shardingInfo: WorkerShardingInfo[] = await Promise.all(
query.docs.map(async (worker) => {
const slice: Slice = worker.get("slice");
const stats: WorkerStats = worker.get("stats");
// This workers hasn't had a chance to finish its run yet. Bail out.
if (!stats) {
return {
slice: slice,
hasData: false,
overloaded: false,
splits: [],
};
}
const hasData = true;