Skip to content

Commit

Permalink
Remove the NOTIFY and LISTEN for metric emiter. No sense on using the…
Browse files Browse the repository at this point in the history
…m now.

Close #3821
  • Loading branch information
decko committed May 6, 2024
1 parent 29537ce commit 82d79e4
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions pulpcore/tasking/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ def _signal_handler(self, thesignal, frame):
def _pg_notify_handler(self, notification):
if notification.channel == "pulp_worker_wakeup":
self.wakeup = True
elif notification.channel == "pulp_worker_metrics_heartbeat":
self.last_metric_heartbeat = datetime.fromisoformat(notification.payload)
elif self.task and notification.channel == "pulp_worker_cancel":
if notification.payload == str(self.task.pk):
self.cancel_task = True
Expand Down Expand Up @@ -453,7 +451,7 @@ def record_unblocked_waiting_tasks_metric(self):
unblocked_tasks_stats["longest_unblocked_waiting_time"].seconds
)

self.cursor.execute(f"NOTIFY pulp_worker_metrics_heartbeat, '{str(now)}'")
self.last_metric_heartbeat = now

def run(self, burst=False):
with WorkerDirectory(self.name):
Expand All @@ -463,7 +461,6 @@ def run(self, burst=False):
# Subscribe to pgsql channels
connection.connection.add_notify_handler(self._pg_notify_handler)
self.cursor.execute("LISTEN pulp_worker_cancel")
self.cursor.execute("LISTEN pulp_worker_metrics_heartbeat")
if burst:
self.handle_available_tasks()
else:
Expand All @@ -476,6 +473,5 @@ def run(self, burst=False):
break
self.sleep()
self.cursor.execute("UNLISTEN pulp_worker_wakeup")
self.cursor.execute("UNLISTEN pulp_worker_metrics_heartbeat")
self.cursor.execute("UNLISTEN pulp_worker_cancel")
self.shutdown()

0 comments on commit 82d79e4

Please sign in to comment.