function loadFromCache() {
		const
			timeout = (1).minute();

		let
			total = 0;

		return new Promise((r) => {
			const delay = 500;

			const f = () => {
				// Sometimes we can be caught in the situation when one of the multiple processes writes something
				// to the cache file and it breaks the cache for a moment.
				// To avoid this, we can sleep a little and try again.
				setTimeout(async () => {
					try {
						const
							graph = fs.readJSONSync(graphCacheFile);

						r({
							...graph,
							components: await getComponents()
						});

					} catch (err) {
						total += delay;

						if (total > timeout) {
							build.buildGraphFromCache = false;
							return buildProjectGraph();
						}

						f();
					}
				}, delay);
			};

			f();
		});
	}
/**
	 * Loads the dependency graph from a cache
	 */
Loads the dependency graph from a cache
Loads the dependency graph from a cache
function loadFromCache() {
		const
			timeout = (1).minute();
		let
			total = 0;
		return new Promise((r) => {
			const delay = 500;
			const f = () => {
				setTimeout(async () => {
					try {
						const
							graph = fs.readJSONSync(graphCacheFile);
						r({
							...graph,
							components: await getComponents()
						});
					} catch (err) {
						total += delay;
						if (total > timeout) {
							build.buildGraphFromCache = false;
							return buildProjectGraph();
						}
						f();
					}
				}, delay);
			};
			f();
		});
	}
function loadFromCache ( ) { const timeout = ( 1 ) . minute ( ) ; let total = 0 ; return new Promise ( ( r ) => { const delay = 500 ; const f = ( ) => { setTimeout ( async ( ) => { try { const graph = fs . readJSONSync ( graphCacheFile ) ; r ( { ... graph , components : await getComponents ( ) } ) ; } catch ( err ) { total += delay ; if ( total > timeout ) { build . buildGraphFromCache = false ; return buildProjectGraph ( ) ; } f ( ) ; } } , delay ) ; } ; f ( ) ; } ) ; }
Loads the dependency graph from a cache
Loads the dependency graph from a cache
// Sometimes we can be caught in the situation when one of the multiple processes writes something // to the cache file and it breaks the cache for a moment. // To avoid this, we can sleep a little and try again.