fix: Bug - Sending files and attachment issues
Hydrate playable media after disk receive, relay file-announce to sibling devices via account_sync, bind DM attachments to pre-allocated message ids, and improve gallery retry/cancel UX with bounded parallel auto-downloads. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
||||
import { runTasksWithBoundedConcurrency } from './attachment-autodownload-concurrency.rules';
|
||||
|
||||
describe('attachment-autodownload-concurrency.rules', () => {
|
||||
it('runs tasks with bounded concurrency', async () => {
|
||||
let active = 0;
|
||||
let maxActive = 0;
|
||||
|
||||
const tasks = Array.from({ length: 6 }, (_, index) => async () => {
|
||||
active += 1;
|
||||
maxActive = Math.max(maxActive, active);
|
||||
await new Promise((resolve) => setTimeout(resolve, 5));
|
||||
active -= 1;
|
||||
|
||||
return index;
|
||||
});
|
||||
const results = await runTasksWithBoundedConcurrency(tasks, 2);
|
||||
|
||||
expect(results).toEqual([
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5
|
||||
]);
|
||||
|
||||
expect(maxActive).toBeLessThanOrEqual(2);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user