Open Qiwn opened 3 years ago
@bloodbare @vangheem @jordic What do you think about this? IMO this is something interesting to implement in G7
From my point of view, this is cleary a bug, if we support "virtual transactions" we should do the correct way, and data within boundaries should be consistent!
Looks like a good idea to clean up the g transaction flow.
In your use case https://github.com/plone/guillotina/blob/master/guillotina/content.py#L358 is the responsible that at async_get gets None because its not on db, so fixing that async_get can retrieve from txn objects (we will need to store the parent and id on the txn virtual state) may be enought to fix this issue.
After the PR the main scope will be fixed. There is still an inconsistency on async_len, aync_keys, async_values .... all this functions will not be consistent with modified objects and may be the scope for a future cache refactor.
Transaction only considers the objects in pg, it doesn't consider those objects are not stored in pg yet (they are in txn.deleted/added dict). It would be great if this kind of cases are contemplated:
Another case: https://github.com/plone/guillotina/pull/1053