iameru/mschleuder

product unit issue

Closed this issue · 2 comments

cant edit product.

clicked a bit around, changing a product into one without units and back, made a distribution. now no edit, probably a commit missing:

sqlite3.OperationalError: database is locked

when asking for ciurrent distribution in context processor. finer traceback:

sqlalchemy.exc.OperationalError: (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely)
(sqlite3.OperationalError) database is locked
[SQL: DELETE FROM product_units WHERE product_units.unit_id = ? AND product_units.product_id = ?]
[parameters: ((1, 2), (3, 2), (2, 2))]
(Background on this error at: https://sqlalche.me/e/14/e3q8)

the finer traceback probably is not the source of this bug.

when going into distribution:
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) database is locked
[SQL: INSERT INTO distribution (created, updated, in_progress, finalized, date_time) VALUES (?, ?, ?, ?, ?)]
[parameters: ('2022-10-06 19:38:00.000000', None, 1, 0, '2022-10-06 19:38:00.000000')]
(Background on this error at: https://sqlalche.me/e/14/e3q8)

but with the point

File "/home/v/wrk/ms/ms/distribution/views.py", line 47, in trigger

db.session.commit()

could not reproduce so far.

must be something missed which locks the database