perf(worker): try to improve perf of worker

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-09-24 09:19:30 +02:00
parent a1278ca371
commit 25a7365569
6 changed files with 425 additions and 359 deletions

View File

@@ -219,27 +219,4 @@ export class ProfileBuffer extends RedisBuffer<BufferType> {
});
await multi.exec();
}
public findMany: FindMany<IClickhouseProfile, IServiceProfile> = async (
callback,
) => {
return this.getQueue(-1)
.then((queue) => {
return queue.filter(callback).map(transformProfile);
})
.catch(() => {
return [];
});
};
public find: Find<IClickhouseProfile, IServiceProfile> = async (callback) => {
return this.getQueue(-1)
.then((queue) => {
const match = queue.find(callback);
return match ? transformProfile(match) : null;
})
.catch(() => {
return null;
});
};
}