source: trip-planner-front/node_modules/@angular/compiler-cli/ngcc/src/locking/async_locker.d.ts@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/// <amd-module name="@angular/compiler-cli/ngcc/src/locking/async_locker" />
2/**
3 * @license
4 * Copyright Google LLC All Rights Reserved.
5 *
6 * Use of this source code is governed by an MIT-style license that can be
7 * found in the LICENSE file at https://angular.io/license
8 */
9import { Logger } from '../../../src/ngtsc/logging';
10import { LockFile } from './lock_file';
11/**
12 * AsyncLocker is used to prevent more than one instance of ngcc executing at the same time,
13 * when being called in an asynchronous context.
14 *
15 * * When ngcc starts executing, it creates a file in the `compiler-cli/ngcc` folder.
16 * * If it finds one is already there then it pauses and waits for the file to be removed by the
17 * other process. If the file is not removed within a set timeout period given by
18 * `retryDelay*retryAttempts` an error is thrown with a suitable error message.
19 * * If the process locking the file changes, then we restart the timeout.
20 * * When ngcc completes executing, it removes the file so that future ngcc executions can start.
21 */
22export declare class AsyncLocker {
23 private lockFile;
24 protected logger: Logger;
25 private retryDelay;
26 private retryAttempts;
27 constructor(lockFile: LockFile, logger: Logger, retryDelay: number, retryAttempts: number);
28 /**
29 * Run a function guarded by the lock file.
30 *
31 * @param fn The function to run.
32 */
33 lock<T>(fn: () => Promise<T>): Promise<T>;
34 protected create(): Promise<void>;
35}
Note: See TracBrowser for help on using the repository browser.