fix: hatchet-lite connection leakage and improve listen/notify performance (#1924)

* fix: hatchet-lite connection leakage and improve listen/notify performance

* fix: cancel mq listener

* remove event deps

* skip webhook test for now
This commit is contained in:
abelanger5
2025-06-30 17:13:09 -04:00
committed by GitHub
parent b6d5a38c0f
commit 1abb2a20e7
8 changed files with 498 additions and 55 deletions

View File

@@ -143,6 +143,13 @@ func (p *PostgresMessageQueue) addMessage(ctx context.Context, queue msgqueue.Qu
return err
}
// notify the queue that a new message has been added
err = p.repo.Notify(ctx, queue.Name(), "")
if err != nil {
p.l.Error().Err(err).Msgf("error notifying queue %s", queue.Name())
}
if task.TenantID != "" {
return p.addTenantExchangeMessage(ctx, queue, task)
}
@@ -259,7 +266,7 @@ func (p *PostgresMessageQueue) Subscribe(queue msgqueue.Queue, preAck msgqueue.A
// start the listener
go func() {
err := p.repo.Listen(subscribeCtx, queue.Name(), func(ctx context.Context, notification *repository.PubMessage) error {
err := p.repo.Listen(subscribeCtx, queue.Name(), func(ctx context.Context, notification *repository.PubSubMessage) error {
// if this is not a durable queue, and the message starts with JSON '{', then we process the message directly
if !queue.Durable() && len(notification.Payload) >= 1 && notification.Payload[0] == '{' {
var task msgqueue.Message