1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-04-10 15:47:32 +00:00

Resolve "Disable SILKY_ANALYZE_QUERIES by default in developer env as it causes double data updates"

This commit is contained in:
Nigel Gott 2023-02-21 06:04:18 +00:00
parent efc57a28f2
commit b3d9b6a417
4 changed files with 32 additions and 1 deletions

View file

@ -24,3 +24,9 @@ PUBLIC_BACKEND_URL=http://localhost:8000
PUBLIC_WEB_FRONTEND_URL=http://localhost:3000
# If you change WEB_FRONTEND_PORT above you also need the change the 4000 here to match.
MEDIA_URL=http://localhost:4000/media/
# Uncommenting this will make silky run EXPLAIN postgres statements for every query.
# This is dangerous as EXPLAIN actually executes every query a second time, so with this
# on all UPDATE's will run twice. Only use for performance analysis and turn off
# immediately after!
# BASEROW_DANGEROUS_SILKY_ANALYZE_QUERIES=true

View file

@ -17,7 +17,20 @@ MIDDLEWARE += [ # noqa: F405
"silk.middleware.SilkyMiddleware",
]
SILKY_ANALYZE_QUERIES = True
# Set this env var to any non-blank value in your dev env so django-silk will EXPLAIN
# all queries run.
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! MASSIVE WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# This setting is DANGEROUS and will cause ALL UPDATE statements run by Baserow to be
# run twice.
# Any update statements that are not idempotent will become buggy!
# Only turn it on to analyse performance, it will break Baserow's business
# logic and cause bugs and so don't ever have it on whilst testing Baserow's
# functionality.
# See https://github.com/jazzband/django-silk/issues/629.
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
SILKY_ANALYZE_QUERIES = bool(
os.getenv("BASEROW_DANGEROUS_SILKY_ANALYZE_QUERIES", False) # noqa: F405
)
snoop.install()

View file

@ -0,0 +1,7 @@
{
"type": "bug",
"message": "disable silky_analyze_queries by default in developer env as it causes double data updates",
"issue_number": 1591,
"bullet_points": [],
"created_at": "2023-02-17"
}

View file

@ -22,6 +22,7 @@ services:
environment:
- BASEROW_BACKEND_DEBUGGER_ENABLED=${BASEROW_BACKEND_DEBUGGER_ENABLED:-True}
- BASEROW_BACKEND_DEBUGGER_PORT=${BASEROW_BACKEND_DEBUGGER_PORT:-5678}
- BASEROW_DANGEROUS_SILKY_ANALYZE_QUERIES
build:
dockerfile: ./backend/Dockerfile
context: .
@ -79,6 +80,8 @@ services:
UID: $UID
GID: $GID
command: "watch-py celery-worker"
environment:
- BASEROW_DANGEROUS_SILKY_ANALYZE_QUERIES
volumes:
- ./backend:/baserow/backend
- ./premium/backend/:/baserow/premium/backend
@ -99,6 +102,8 @@ services:
UID: $UID
GID: $GID
command: "watch-py celery-exportworker"
environment:
- BASEROW_DANGEROUS_SILKY_ANALYZE_QUERIES
volumes:
- ./backend:/baserow/backend
- ./premium/backend/:/baserow/premium/backend