diff --git a/influxdb_client/client/write_api.py b/influxdb_client/client/write_api.py index 3b3db68f..88ae4991 100644 --- a/influxdb_client/client/write_api.py +++ b/influxdb_client/client/write_api.py @@ -387,8 +387,8 @@ def write_payload(payload): def flush(self): """Flush data.""" - # TODO - pass + if self._subject: + self._subject.on_completed() def close(self): """Flush data and dispose a batching buffer.""" @@ -411,8 +411,8 @@ def __exit__(self, exc_type, exc_val, exc_tb): def __del__(self): """Close WriteApi.""" + self.flush() if self._subject: - self._subject.on_completed() self._subject.dispose() self._subject = None