osm-fr / osmose-frontend

Part of osmose that shows results on the website http://osmose.openstreetmap.fr
GNU General Public License v3.0
41 stars 39 forks source link

UPSERT markers at the end of the transaction, avoid long standing locker row #461 #462

Closed frodrigo closed 11 months ago

frodrigo commented 1 year ago

UPSERT markers at the end of the transaction, avoid long standing locker row #461

frodrigo commented 1 year ago

Fails with

2023-06-03 15:03:53       error: UPDATE ERROR russia_adygea_republic/Sax : {"detail":"Traceback (most recent call last):
  File \"/data/project/osmose/frontend/control/update.py\", line 77, in user
    await update_utils.update(db, source_id, f.name, remote_ip=remote_ip)
  File \"/data/project/osmose/frontend/control/update_utils.py\", line 90, in update
    tasks[1].result()
  File \"/data/project/osmose/frontend/control/update_utils.py\", line 72, in async_parser_task
    await async_update_parser(source_id, fname, remote_ip, db).parse(q)
  File \"/data/project/osmose/frontend/control/update_utils.py\", line 447, in parse
    await self.endElement(*args)
  File \"/data/project/osmose/frontend/control/update_utils.py\", line 567, in endElement
    await table_merge_markers_tmp(self._db, self.all_uuid)
  File \"/data/project/osmose/frontend/control/update_utils.py\", line 357, in table_merge_markers_tmp
    await _db.execute(sql_marker)
  File \"/data/project/osmose/frontend/osmose-frontend-venv/lib/python3.9/site-packages/asyncpg/connection.py\", line 317, in execute
    return await self._protocol.query(query, timeout)
  File \"asyncpg/protocol/protocol.pyx\", line 338, in query
asyncpg.exceptions.CardinalityViolationError: ON CONFLICT DO UPDATE command cannot affect row a second time
HINT:  Ensure that no rows proposed for insertion within the same command have duplicate constrained values."}