Skip to content

Commit

Permalink
Always invalidate_caches when loading snapshots
Browse files Browse the repository at this point in the history
Originally we had baseline snapshots shared and dedicated snapshots per worker.
But now we also have shared package snapshots. To be safe let's just always call
it.
  • Loading branch information
hoodmane committed Sep 6, 2024
1 parent 39b0c32 commit d125726
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/pyodide/internal/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,14 +437,11 @@ let TEST_SNAPSHOT: Uint8Array | undefined = undefined;
})();

export function finishSnapshotSetup(pyodide: Pyodide): void {
if (DSO_METADATA?.settings?.baselineSnapshot) {
// Invalidate caches if we have a baseline snapshot because the contents of site-packages may
// have changed.
simpleRunPython(
pyodide._module,
'from importlib import invalidate_caches as f; f(); del f'
);
}
// Invalidate caches if we have a snapshot because the contents of site-packages may have changed.
simpleRunPython(
pyodide._module,
'from importlib import invalidate_caches as f; f(); del f'
);

// This is just here for our test suite. Ugly but just about the only way to test this.
if (TEST_SNAPSHOT) {
Expand Down

0 comments on commit d125726

Please sign in to comment.