File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -215,7 +215,11 @@ func (b *AMQPBroker) connect() {
215215 log .Get ().Info ("CONNECTING..." )
216216
217217 for {
218- connection , err := amqp .Dial (b .url )
218+ connection , err := amqp .DialConfig (b .url , amqp.Config {
219+ Heartbeat : 60 * time .Second ,
220+ Locale : "en_US" ,
221+ })
222+
219223 if err != nil {
220224 log .Get ().Error (fmt .Sprintf ("broker/amqp: fail to connect: %v" , err ))
221225 time .Sleep (b .backoff .Duration ())
Original file line number Diff line number Diff line change @@ -87,10 +87,12 @@ func (w *worker) executeJob() {
8787 index := i
8888 oldWrapped := wrappedHandle
8989
90- wrappedHandle = func (ctx context.Context ) error {
91- return w .middlewares [index ](injectJobInfo (ctx , * job , message ),
92- oldWrapped )
93- }
90+ wrappedHandle = func (index int ) func (context.Context ) error {
91+ return func (ctx context.Context ) error {
92+ return w .middlewares [index ](injectJobInfo (ctx , * job , message ),
93+ oldWrapped )
94+ }
95+ }(index )
9496 }
9597
9698 ctx , cancelFn := context .WithCancel (context .Background ())
You can’t perform that action at this time.
0 commit comments