From 0958348c336d2b1fb5f18b48200e9622e2c2c4fd Mon Sep 17 00:00:00 2001 From: Benjamin Schmidt Date: Fri, 20 Sep 2024 04:07:27 +0100 Subject: [PATCH] Remove the deferred functions queue (#138) This is dead code, and is a pretty finicky thing that we could implement better. ---- | :rocket: | This description was created by 552887aaf2cb0ed9a819fa564f61e1606158d563 | |--------|--------| refactor: remove unused deferred functions from rendering classes ### Summary: This pull request removes unused deferred functions from rendering files, simplifying the rendering process. **Key points**: - Remove unused `deferred_functions` array from `Renderer` class in `src/rendering.ts`. - Remove `pop_deferred_functions` function from `ReglRenderer` class in `src/regl_rendering.ts`. - Delete comments related to deferred functions in both files. - Simplify rendering process by removing unused code. ---- Generated with :heart: by [ellipsis.dev](https://www.ellipsis.dev) --- src/regl_rendering.ts | 21 --------------------- src/rendering.ts | 3 --- 2 files changed, 24 deletions(-) diff --git a/src/regl_rendering.ts b/src/regl_rendering.ts index feeddf635..4a44c67d9 100644 --- a/src/regl_rendering.ts +++ b/src/regl_rendering.ts @@ -228,8 +228,6 @@ export class ReglRenderer extends Renderer { tile._buffer_manager || new TileBufferManager(this.regl, tile, this); if (!tile._buffer_manager.ready()) { - // The 'ready' call also pushes a creation request into - // the deferred_functions queue. continue; } const this_props = { @@ -296,25 +294,6 @@ export class ReglRenderer extends Renderer { const start = Date.now(); - async function pop_deferred_functions( - deferred_functions: (() => void | Promise)[], - ) { - while (Date.now() - start < 10 && deferred_functions.length > 0) { - // Keep popping deferred functions off the queue until we've spent 10 milliseconds doing it. - const current = deferred_functions.shift(); - if (current === undefined) { - continue; - } - try { - await current(); - } catch (error) { - console.warn(error, current); - } - } - } - // Run 10 ms of deferred functions. - void pop_deferred_functions(this.deferred_functions); - try { this.render_all(props); } catch (error) { diff --git a/src/rendering.ts b/src/rendering.ts index c56caf937..39674ab61 100644 --- a/src/rendering.ts +++ b/src/rendering.ts @@ -128,8 +128,6 @@ export class Renderer { public deeptable: Deeptable; public width: number; public height: number; - // The renderer handles periodic dispatches of calls - public deferred_functions: Array<() => Promise | void>; public _use_scale_to_download_tiles = true; public aes?: AestheticSet; public _zoom?: Zoom; @@ -142,7 +140,6 @@ export class Renderer { ).node() as HTMLCanvasElement; this.width = +select(this.canvas).attr('width'); this.height = +select(this.canvas).attr('height'); - this.deferred_functions = []; this._use_scale_to_download_tiles = true; }