From 4e6abef720018e4936604294428d9ef896366d51 Mon Sep 17 00:00:00 2001 From: langhuihui <178529795@qq.com> Date: Mon, 22 Sep 2025 19:33:44 +0800 Subject: [PATCH] fix: pull job publisher panic --- puller.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/puller.go b/puller.go index ba915d9..c535810 100644 --- a/puller.go +++ b/puller.go @@ -239,13 +239,15 @@ func (p *PullJob) Publish() (err error) { if len(p.Connection.Args) > 0 { streamPath += "?" + p.Connection.Args.Encode() } - p.Publisher, err = p.Plugin.PublishWithConfig(p.puller, streamPath, p.PublishConfig) + var publisher *Publisher + publisher, err = p.Plugin.PublishWithConfig(p.puller, streamPath, p.PublishConfig) if err == nil { - p.Publisher.OnDispose(func() { - if p.Publisher.StopReasonIs(pkg.ErrPublishDelayCloseTimeout, task.ErrStopByUser) || p.MaxRetry == 0 { - p.Stop(p.Publisher.StopReason()) + p.Publisher = publisher + publisher.OnDispose(func() { + if publisher.StopReasonIs(pkg.ErrPublishDelayCloseTimeout, task.ErrStopByUser) || p.MaxRetry == 0 { + p.Stop(publisher.StopReason()) } else { - p.puller.Stop(p.Publisher.StopReason()) + p.puller.Stop(publisher.StopReason()) } }) }