Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
Signed-off-by: 0ssigeno <s.berni@certego.net>
  • Loading branch information
0ssigeno committed Mar 27, 2024
1 parent 3e46d27 commit b20d6a2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions api_app/migrations/0061_job_depth_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ class Migration(migrations.Migration):
operations = [
migrations.SeparateDatabaseAndState(
database_operations=[
migrations.RunSQL(
"CREATE UNIQUE INDEX IF NOT EXISTS api_app_job_path_f745a786_uniq ON api_app_job USING btree (path)"
),
migrations.RunPython(migrate, migrations.RunPython.noop),
],
state_operations=[
Expand Down
7 changes: 6 additions & 1 deletion api_app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,12 @@ def __str__(self):
def get_root(self):
if self.is_root():
return self
return super().get_root()
try:
return super().get_root()
except self.MultipleObjectsReturned:
# django treebeard is not thread safe
# this is not a really valid solution, but it will work for now
return self.objects.filter(path=self.path[0 : self.steplen]).first() # noqa

@property
def analyzed_object_name(self):
Expand Down

0 comments on commit b20d6a2

Please sign in to comment.