Skip to content

[Style] Discretization fails on large layers due to 30s database timeout #953

@bruhnild

Description

@bruhnild

Context:
When performing a discretization (styling) on a layer containing several million entities, the SQL query executed by TerraVisu in the database fails to complete before the current timeout (30 seconds).
As a result, the process is interrupted before completion, causing an error and preventing the style from being updated.

Steps to reproduce

  1. Load a layer with several million entities in TerraVisu.
  2. Run a discretization through the back-office (e.g. a Jenks classification).
  3. Observe that the query exceeds the 30-second timeout and fails.

Expected behavior

The discretization query should be able to complete successfully without errors, even for very large layers.

Possible solutions

Two possible improvements:

  1. Increase the query timeout

    • Add a configuration variable in TerraVisu
    • Default value: 30 seconds
    • Allow it to be increased (e.g. 120 seconds) depending on the server’s capacity
  2. Run the discretization as an asynchronous task (via Celery)

    • Would prevent the web server from being blocked during processing
    • Requires more development effort but would be more robust in the long term

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions