Skip to content

Commit

Permalink
FIX: Do not overwrite timestamp if already provided
Browse files Browse the repository at this point in the history
  • Loading branch information
emam-kpn authored and eigenein committed Feb 7, 2023
1 parent cffc482 commit 17473f7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 0 additions & 3 deletions tests/test_elasticsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def _query_backend(self, name):

class TestTimeExecution(BaseTestTimeExecutionElasticSearch):
def test_time_execution(self):

count = 4

for i in range(count):
Expand Down Expand Up @@ -110,7 +109,6 @@ def test_metadata(*args, **kwargs):

@mock.patch("time_execution.backends.elasticsearch.logger")
def test_error_warning(self, mocked_logger):

transport_error = TransportError("mocked error")
es_index_error_ctx = mock.patch(
"time_execution.backends.elasticsearch.Elasticsearch.index",
Expand All @@ -132,7 +130,6 @@ def test_error_warning(self, mocked_logger):

def test_with_origin(self):
with settings(origin="unit_test"):

go()

for metric in self._query_backend(go.get_fqn())["hits"]["hits"]:
Expand Down
3 changes: 2 additions & 1 deletion time_execution/backends/threaded.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ def __init__(
self.start_worker()

def write(self, name, **data):
data["timestamp"] = datetime.datetime.utcnow()
if "timestamp" not in data:
data["timestamp"] = datetime.datetime.utcnow()
try:
self._queue.put_nowait((name, data))
except Full:
Expand Down

0 comments on commit 17473f7

Please sign in to comment.