fix(monitor): Use datetime.utcnow() instead of timezone.utc
Python 2, 3 compatibility issue
This commit is contained in:
parent
56e1cdde53
commit
cb3507f5e4
1 changed files with 3 additions and 3 deletions
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from datetime import datetime, timezone
|
||||
from datetime import datetime
|
||||
import json
|
||||
import traceback
|
||||
import frappe
|
||||
|
|
@ -35,7 +35,7 @@ class Monitor:
|
|||
def __init__(self, transaction_type=None, method=None, kwargs=None):
|
||||
try:
|
||||
self.site = frappe.local.site
|
||||
self.timestamp = datetime.now(timezone.utc)
|
||||
self.timestamp = datetime.utcnow()
|
||||
self.transaction_type = transaction_type
|
||||
self.uuid = uuid.uuid4()
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ class Monitor:
|
|||
|
||||
def dump(self):
|
||||
try:
|
||||
timediff = datetime.now(timezone.utc) - self.timestamp
|
||||
timediff = datetime.utcnow() - self.timestamp
|
||||
# Obtain duration in microseconds
|
||||
self.duration = int(timediff.total_seconds() * 1000000)
|
||||
data = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue