Use playbook.updated instead of "now" for calculating duration
Using now() to calculate the duration was not accurate. If a playbook had never ended, it would show that a playbook ran yesterday for >40k seconds and keep growing, for example. playbook.updated is the next best thing we've got so let's use that. Change-Id: I66c6073879d716586425e0a84f3da1dcbf04c7e8
This commit is contained in:
parent
031e757979
commit
8f4ed9e541
|
@ -20,7 +20,6 @@ import json
|
|||
import logging
|
||||
import zlib
|
||||
|
||||
from django.utils import timezone
|
||||
from rest_framework import serializers
|
||||
|
||||
from ara.api import models
|
||||
|
@ -70,7 +69,7 @@ class DurationSerializer(serializers.ModelSerializer):
|
|||
@staticmethod
|
||||
def get_duration(obj):
|
||||
if obj.ended is None:
|
||||
return timezone.now() - obj.started
|
||||
return obj.updated - obj.started
|
||||
return obj.ended - obj.started
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue