only lock mapupdate for writable requests
This commit is contained in:
parent
b14036437a
commit
c92513f0c5
1 changed files with 6 additions and 1 deletions
|
@ -35,13 +35,18 @@ def maybe_lock_changeset_to_edit(request):
|
||||||
yield
|
yield
|
||||||
|
|
||||||
|
|
||||||
|
@contextmanager
|
||||||
|
def noctx():
|
||||||
|
yield
|
||||||
|
|
||||||
|
|
||||||
def accesses_mapdata(func):
|
def accesses_mapdata(func):
|
||||||
@wraps(func)
|
@wraps(func)
|
||||||
def wrapped(request, *args, **kwargs):
|
def wrapped(request, *args, **kwargs):
|
||||||
writable_method = request.method in ("POST", "PUT")
|
writable_method = request.method in ("POST", "PUT")
|
||||||
|
|
||||||
if request.changeset.direct_editing:
|
if request.changeset.direct_editing:
|
||||||
with MapUpdate.lock():
|
with (MapUpdate.lock() if writable_method else noctx()):
|
||||||
changed_geometries.reset()
|
changed_geometries.reset()
|
||||||
with DatabaseOverlayManager.enable(changes=None, commit=writable_method) as manager:
|
with DatabaseOverlayManager.enable(changes=None, commit=writable_method) as manager:
|
||||||
result = func(request, *args, **kwargs)
|
result = func(request, *args, **kwargs)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue