Skip to content

Fix bug committing snippet content when creating the snippet

What does this MR do?

In 4240c445, we implemented the action to commit the snippet content to the snippet repository when it was created. Nevertheless, once integrated we have realized there is a bug, related to db transactions and threads.

When the snippet is created and the content committed everything is inside a transaction. Nevertheless, the commit action triggers a request to the internal api which is handled by a different thread. This means that, while the recently created snippet exists in the main thread, because of the transaction, the snippet is not available in the thread that performs the commits action.

We need to extract the commit action outside the transaction and, therefore handle the actions that will happen when if there is an error.

Refs #39265 (closed) and #199221 (closed) Closes #208693 (closed)

Does this MR meet the acceptance criteria?

Conformity

Edited by 🤖 GitLab Bot 🤖

Merge request reports