Skip to content

Commit

Permalink
Remove the deferred functions queue (#138)
Browse files Browse the repository at this point in the history
This is dead code, and is a pretty finicky thing that we could implement better.
<!-- ELLIPSIS_HIDDEN -->


----

| 🚀 | This description was created by 552887a  | 
|--------|--------|

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 ❤️ by [ellipsis.dev](https://www.ellipsis.dev)



<!-- ELLIPSIS_HIDDEN -->
  • Loading branch information
bmschmidt authored Sep 20, 2024
1 parent 1b1febb commit 0958348
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 24 deletions.
21 changes: 0 additions & 21 deletions src/regl_rendering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -296,25 +294,6 @@ export class ReglRenderer extends Renderer {

const start = Date.now();

Check failure on line 295 in src/regl_rendering.ts

View workflow job for this annotation

GitHub Actions / deploy-docs

'start' is declared but its value is never read.

async function pop_deferred_functions(
deferred_functions: (() => void | Promise<void>)[],
) {
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) {
Expand Down
3 changes: 0 additions & 3 deletions src/rendering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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> | void>;
public _use_scale_to_download_tiles = true;
public aes?: AestheticSet;
public _zoom?: Zoom;
Expand All @@ -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;
}

Expand Down

0 comments on commit 0958348

Please sign in to comment.