Skip to content

Commit

Permalink
Add logging for times to save a document with history. Commit ready f…
Browse files Browse the repository at this point in the history
…or merge.

 - Legacy-Id: 18698
  • Loading branch information
rjsparks committed Nov 16, 2020
1 parent 0bf56c9 commit ec061de
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ietf/doc/models.py
Expand Up @@ -7,6 +7,7 @@
import io
import os
import rfc2html
import time

from django.db import models
from django.core import checks
Expand Down Expand Up @@ -715,12 +716,16 @@ def save_with_history(self, events):
assert events, "You must always add at least one event to describe the changes in the history log"
self.time = max(self.time, events[0].time)

mark = time.time()
self._has_an_event_so_saving_is_allowed = True
self.save()
del self._has_an_event_so_saving_is_allowed
log.log(f'{time.time()-mark:.3f} seconds to save Document object')

mark = time.time()
from ietf.doc.utils import save_document_in_history
save_document_in_history(self)
log.log(f'{time.time()-mark:.3f} seconds to save Document in history')

def save(self, *args, **kwargs):
# if there's no primary key yet, we can allow the save to go
Expand Down

0 comments on commit ec061de

Please sign in to comment.