mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2026-01-06 08:49:53 -06:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user