Skip to content

Commit

Permalink
render-test-flakiness:clear worker storage (#11111)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arindam Bose authored Oct 12, 2021
1 parent 1c261a7 commit 1c416c6
Showing 6 changed files with 23 additions and 11 deletions.
14 changes: 5 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2.1
orbs:
aws-cli: circleci/aws-cli@1.4.0
browser-tools: circleci/browser-tools@1.1.1
browser-tools: circleci/browser-tools@1.2.3

workflows:
version: 2
@@ -245,8 +245,7 @@ jobs:
steps:
- attach_workspace:
at: ~/
- browser-tools/install-chrome:
chrome-version: 91.0.4472.164
- browser-tools/install-chrome
- run: yarn run test-render
- store_test_results:
path: test/integration/render-tests
@@ -258,8 +257,7 @@ jobs:
steps:
- attach_workspace:
at: ~/
- browser-tools/install-chrome:
chrome-version: 91.0.4472.164
- browser-tools/install-chrome
- run: yarn run test-render-prod
- store_test_results:
path: test/integration/render-tests
@@ -271,8 +269,7 @@ jobs:
steps:
- attach_workspace:
at: ~/
- browser-tools/install-chrome:
chrome-version: 91.0.4472.164
- browser-tools/install-chrome
- run: yarn run test-query
- store_test_results:
path: test/integration/query-tests
@@ -299,8 +296,7 @@ jobs:
steps:
- attach_workspace:
at: ~/
- browser-tools/install-chrome:
chrome-version: 91.0.4472.164
- browser-tools/install-chrome
- run:
name: Collect performance stats
command: node bench/gl-stats.js
8 changes: 8 additions & 0 deletions src/source/worker.js
Original file line number Diff line number Diff line change
@@ -78,6 +78,14 @@ export default class Worker {
};
}

clearCaches(mapId: string, unused: mixed, callback: WorkerTileCallback) {
delete this.layerIndexes[mapId];
delete this.availableImages[mapId];
delete this.workerSources[mapId];
delete this.demWorkerSources[mapId];
callback();
}

checkIfReady(mapID: string, unused: mixed, callback: WorkerTileCallback) {
// noop, used to check if a worker is fully set up and ready to receive messages
callback();
4 changes: 4 additions & 0 deletions src/style/style.js
Original file line number Diff line number Diff line change
@@ -1765,6 +1765,10 @@ class Style extends Evented {
hasCircleLayers(): boolean {
return this._numCircleLayers > 0;
}

clearWorkerCaches() {
this.dispatcher.broadcast('clearCaches');
}
}

Style.getSourceType = getSourceType;
3 changes: 3 additions & 0 deletions src/ui/map.js
Original file line number Diff line number Diff line change
@@ -3078,6 +3078,9 @@ class Map extends Camera {
}
this._renderTaskQueue.clear();
this._domRenderTaskQueue.clear();
if (this.style) {
this.style.clearWorkerCaches();
}
this.painter.destroy();
this.handlers.destroy();
delete this.handlers;
2 changes: 1 addition & 1 deletion test/integration/lib/query.js
Original file line number Diff line number Diff line change
@@ -149,7 +149,7 @@ async function runTest(t) {
];
}

browserWriteFile.postMessage(fileInfo);
if (!process.env.CI) browserWriteFile.postMessage(fileInfo);

} catch (e) {
t.error(e);
3 changes: 2 additions & 1 deletion test/integration/lib/render.js
Original file line number Diff line number Diff line change
@@ -74,6 +74,7 @@ function ensureTeardown(t) {
delete map.painter.context.gl;
map = null;
}
mapboxgl.clearStorage();
expectedCtx.clearRect(0, 0, expectedCanvas.width, expectedCanvas.height);
diffCtx.clearRect(0, 0, diffCanvas.width, diffCanvas.height);

@@ -308,7 +309,7 @@ async function runTest(t) {
updateHTML(testMetaData);
}

browserWriteFile.postMessage(fileInfo);
if (!process.env.CI) browserWriteFile.postMessage(fileInfo);

} catch (e) {
t.error(e);

0 comments on commit 1c416c6

Please sign in to comment.