(activityKey: string)
| 18 | * Call the returned release function once the activity has finished. |
| 19 | */ |
| 20 | export function acquireDaemonActivity(activityKey: string): () => void { |
| 21 | const key = activityKey.trim(); |
| 22 | if (!key) { |
| 23 | throw new Error('activityKey must be a non-empty string'); |
| 24 | } |
| 25 | |
| 26 | incrementActivity(key); |
| 27 | |
| 28 | let released = false; |
| 29 | return (): void => { |
| 30 | if (released) { |
| 31 | return; |
| 32 | } |
| 33 | released = true; |
| 34 | decrementActivity(key); |
| 35 | }; |
| 36 | } |
| 37 | |
| 38 | export interface DaemonActivitySnapshot { |
| 39 | activeOperationCount: number; |
no test coverage detected