move with block inside of while to free up persistent db connection

Signed-off-by: jessicamack <jmack@redhat.com>
This commit is contained in:
jessicamack 2023-04-24 10:46:14 -04:00
parent 397d58c459
commit 3025ef0dfa

View File

@ -58,11 +58,11 @@ class Command(BaseCommand):
sys.exit(1)
def do_hearbeat_loop(self):
with pg_bus_conn(new_connection=True) as conn:
while True:
while True:
with pg_bus_conn(new_connection=True) as conn:
logger.debug('Sending heartbeat')
conn.notify('web_heartbeet', self.construct_payload())
time.sleep(settings.BROADCAST_WEBSOCKET_BEACON_FROM_WEB_RATE_SECONDS)
time.sleep(settings.BROADCAST_WEBSOCKET_BEACON_FROM_WEB_RATE_SECONDS)
def handle(self, *arg, **options):
self.print_banner()