diff --git a/node-daemon/pvcd/MetadataAPIInstance.py b/node-daemon/pvcd/MetadataAPIInstance.py index bd29faef..6c474d6e 100644 --- a/node-daemon/pvcd/MetadataAPIInstance.py +++ b/node-daemon/pvcd/MetadataAPIInstance.py @@ -24,6 +24,7 @@ import gevent.pywsgi import flask import threading import sys +import time import psycopg2 from psycopg2.extras import RealDictCursor @@ -112,7 +113,9 @@ class MetadataAPIInstance(object): self.logger.out('Stopping Metadata API at 169.254.169.254:80', state='i') try: self.md_http_server.stop() + time.sleep(0.1) self.md_http_server.close() + time.sleep(0.1) self.md_http_server = None self.logger.out('Successfully stopped Metadata API', state='o') except Exception as e: