packages/avet-build/lib/server/on-demand-entry-handler.js
function disposeInactiveEntries(
  devMiddleware,
  entries,
  lastAccessPages,
  maxInactiveAge
) {
  const disposingPages = [];

  Object.keys(entries).forEach(page => {
    const { lastActiveTime, status } = entries[page];

    // This means this entry is currently building or just added
    // We don't need to dispose those entries.
    if (status !== BUILT) return;

    // We should not build the last accessed page even we didn't get any pings
    // Sometimes, it's possible our XHR ping to wait before completing other requests.
    // In that case, we should not dispose the current viewing page
    if (lastAccessPages[0] === page) return;

    if (Date.now() - lastActiveTime > maxInactiveAge) {
      disposingPages.push(page);
    }
  });

  if (disposingPages.length > 0) {
    disposingPages.forEach(page => {
      delete entries[page];
    });
    console.log(`> Disposing inactive page(s): ${disposingPages.join(', ')}`);
    devMiddleware.invalidate();
  }
}
function disposeInactiveEntries(
  devMiddleware,
  entries,
  lastAccessPages,
  maxInactiveAge
) {
  const disposingPages = [];

  Object.keys(entries).forEach(page => {
    const { lastActiveTime, status } = entries[page];

    // This means this entry is currently building or just added
    // We don't need to dispose those entries.
    if (status !== BUILT) return;

    // We should not build the last accessed page even we didn't get any pings
    // Sometimes, it's possible our XHR ping to wait before completing other requests.
    // In that case, we should not dispose the current viewing page
    if (lastAccessPages[0] === page) return;

    if (Date.now() - lastActiveTime > maxInactiveAge) {
      disposingPages.push(page);
    }
  });

  if (disposingPages.length > 0) {
    disposingPages.forEach(page => {
      delete entries[page];
    });
    console.log(`> Disposing inactive page(s): ${disposingPages.join(', ')}`);
    devMiddleware.invalidate();
  }
}
function disposeInactiveEntries ( devMiddleware , entries , lastAccessPages , maxInactiveAge ) { const disposingPages = [ ] ; Object . keys ( entries ) . forEach ( page => { const { lastActiveTime , status } = entries [ page ] ; // This means this entry is currently building or just added // We don't need to dispose those entries. if ( status !== BUILT ) return ; // We should not build the last accessed page even we didn't get any pings // Sometimes, it's possible our XHR ping to wait before completing other requests. // In that case, we should not dispose the current viewing page if ( lastAccessPages [ 0 ] === page ) return ; if ( Date . now ( ) - lastActiveTime > maxInactiveAge ) { disposingPages . push ( page ) ; } } ) ; if ( disposingPages . length > 0 ) { disposingPages . forEach ( page => { delete entries [ page ] ; } ) ; console . log ( ` ${ disposingPages . join ( ', ' ) } ` ) ; devMiddleware . invalidate ( ) ; } }
dispose inactive pages
dispose inactive pages