diff --git a/glances/exports/export_asyncio.py b/glances/exports/export_asyncio.py index 71ec6a98..6a37f295 100644 --- a/glances/exports/export_asyncio.py +++ b/glances/exports/export_asyncio.py @@ -156,10 +156,7 @@ class GlancesExportAsyncio(GlancesExport): # Submit the export operation to the background event loop try: - future = asyncio.run_coroutine_threadsafe( - self._async_export(name, columns, points), - self.loop - ) + future = asyncio.run_coroutine_threadsafe(self._async_export(name, columns, points), self.loop) # Don't block forever - use a short timeout future.result(timeout=1) except asyncio.TimeoutError: diff --git a/glances/exports/glances_nats/__init__.py b/glances/exports/glances_nats/__init__.py index 97941cfd..b9f17529 100644 --- a/glances/exports/glances_nats/__init__.py +++ b/glances/exports/glances_nats/__init__.py @@ -130,4 +130,5 @@ class Export(GlancesExportAsyncio): logger.error(f"NATS Unexpected error publishing {subject_name}: {e}", exc_info=True) raise + # End of glances/exports/glances_nats/__init__.py diff --git a/tests-data/issues/issue3341-NATS/pub.py b/tests-data/issues/issue3341-NATS/pub.py index 0123b08c..674c4e96 100644 --- a/tests-data/issues/issue3341-NATS/pub.py +++ b/tests-data/issues/issue3341-NATS/pub.py @@ -11,6 +11,7 @@ async def main(): await nc.publish("glances.test", b'A test') await nc.flush() + if __name__ == '__main__': asyncio.run(main()) diff --git a/tests-data/issues/issue3341-NATS/sub.py b/tests-data/issues/issue3341-NATS/sub.py index 07cf5b62..a42fb205 100644 --- a/tests-data/issues/issue3341-NATS/sub.py +++ b/tests-data/issues/issue3341-NATS/sub.py @@ -25,6 +25,7 @@ async def main(): await nc.close() + if __name__ == '__main__': asyncio.run(main())