this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor shouldflush

alice e24cd7c9 7f93ddde

+8 -8
+4 -4
package.json
··· 31 31 "p-limit": "^6.1.0", 32 32 "pg": "^8.13.0", 33 33 "pg-native": "^3.2.0", 34 - "pino": "^9.4.0", 35 - "pino-pretty": "^11.2.2", 34 + "pino": "^9.5.0", 35 + "pino-pretty": "^11.3.0", 36 36 "prom-client": "^15.1.3", 37 37 "terminal-kit": "^3.1.1" 38 38 }, ··· 40 40 "@eslint/js": "^9.12.0", 41 41 "@trivago/prettier-plugin-sort-imports": "^4.3.0", 42 42 "@types/eslint__js": "^8.42.3", 43 - "@types/node": "^22.7.5", 43 + "@types/node": "^22.7.6", 44 44 "eslint": "^9.12.0", 45 45 "prettier": "^3.3.3", 46 46 "tsx": "^4.19.1", 47 47 "typescript": "^5.6.3", 48 - "typescript-eslint": "^8.9.0" 48 + "typescript-eslint": "^8.10.0" 49 49 }, 50 50 "author": "alice", 51 51 "license": "MIT"
+4 -4
src/postgresBatchQueue.ts
··· 28 28 throw new Error('Cannot enqueue data, the queue is shutting down.'); 29 29 } 30 30 31 - let shouldFlush = false; 32 - 33 - await this.mutex.runExclusive(() => { 31 + const shouldFlush = await this.mutex.runExclusive(() => { 34 32 this.queue.push(data); 35 33 36 34 if (this.queue.length >= this.batchSize) { 37 - shouldFlush = true; 35 + return true; 38 36 } else if (!this.batchTimer) { 39 37 this.scheduleFlush(); 40 38 } 39 + 40 + return false; 41 41 }); 42 42 43 43 if (shouldFlush) {