fix(trace viewer): keep sw alive (#9725)
This commit is contained in:
parent
940466f830
commit
e2710451f3
|
|
@ -29,5 +29,7 @@ import '../common.css';
|
|||
navigator.serviceWorker.oncontrollerchange = () => f();
|
||||
});
|
||||
}
|
||||
// Keep SW running.
|
||||
setInterval(function() { fetch('ping'); }, 10000);
|
||||
ReactDOM.render(<Workbench/>, document.querySelector('#root'));
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -56,8 +56,12 @@ async function doFetch(event: FetchEvent): Promise<Response> {
|
|||
const url = new URL(request.url);
|
||||
|
||||
const relativePath = url.pathname.substring(scopePath.length - 1);
|
||||
if (relativePath === '/context') {
|
||||
if (relativePath === '/ping') {
|
||||
await gc();
|
||||
return new Response(null, { status: 200 });
|
||||
}
|
||||
|
||||
if (relativePath === '/context') {
|
||||
const traceModel = await loadTrace(traceUrl, event.clientId);
|
||||
return new Response(JSON.stringify(traceModel!.contextEntry), {
|
||||
status: 200,
|
||||
|
|
|
|||
Loading…
Reference in a new issue