This repository was archived by the owner on May 18, 2022. It is now read-only.
File tree 7 files changed +10
-14
lines changed
7 files changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -2,8 +2,8 @@ package rabbitmq
2
2
3
3
import (
4
4
"sync"
5
+ "time"
5
6
6
- "github.com/smartystreets/clock"
7
7
"github.com/smartystreets/messaging/v2"
8
8
)
9
9
@@ -23,7 +23,7 @@ func (this *ChannelWriter) Write(message messaging.Dispatch) error {
23
23
return messaging .ErrWriterClosed
24
24
}
25
25
26
- dispatch := toAMQPDispatch (message , clock . UTCNow ())
26
+ dispatch := toAMQPDispatch (message , utcNow ())
27
27
err := this .channel .PublishMessage (message .Destination , message .Partition , dispatch )
28
28
if err == nil {
29
29
return nil
@@ -33,7 +33,9 @@ func (this *ChannelWriter) Write(message messaging.Dispatch) error {
33
33
this .channel = nil
34
34
return err
35
35
}
36
-
36
+ func utcNow () time.Time {
37
+ return time .Now ().UTC ()
38
+ }
37
39
func (this * ChannelWriter ) Commit () error {
38
40
return nil
39
41
}
Original file line number Diff line number Diff line change 4
4
5
5
require (
6
6
github.com/smartystreets/assertions v1.1.0
7
- github.com/smartystreets/clock v1.0.3
8
7
github.com/smartystreets/gunit v1.3.4
9
8
github.com/smartystreets/logging v1.1.1
10
9
github.com/smartystreets/messaging/v2 v2.1.1
Original file line number Diff line number Diff line change 1
1
github.com/smartystreets/assertions v1.1.0 h1:MkTeG1DMwsrdH7QtLXy5W+fUxWq+vmb6cLmyJ7aRtF0 =
2
2
github.com/smartystreets/assertions v1.1.0 /go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo =
3
- github.com/smartystreets/clock v1.0.3 h1:rZ2gtRux+yALko49BywVFcrWcfRg8V86Q+wwYP+SCWs =
4
- github.com/smartystreets/clock v1.0.3 /go.mod h1:SeXxrsL1+0aE4256nYPPBWwuA9BGfiXu5+bxfXFsPGA =
5
3
github.com/smartystreets/gunit v1.3.4 h1:iHc8Rfhb/uCOc9a3KGuD3ut22L+hLIVaqR1o5fS6zC4 =
6
4
github.com/smartystreets/gunit v1.3.4 /go.mod h1:ZjM1ozSIMJlAz/ay4SG8PeKF00ckUp+zMHZXV9/bvak =
7
5
github.com/smartystreets/logging v1.1.1 h1:4UlnyYWB7LDd216NTuP3zTVvMQZREtPrDnJbsz0zftI =
Original file line number Diff line number Diff line change 5
5
"time"
6
6
7
7
"github.com/smartystreets/assertions/should"
8
- "github.com/smartystreets/clock"
9
8
"github.com/smartystreets/gunit"
10
9
"github.com/smartystreets/messaging/v2"
11
10
"github.com/streadway/amqp"
@@ -21,7 +20,7 @@ type RabbitAdapterFixture struct {
21
20
}
22
21
23
22
func (this * RabbitAdapterFixture ) Setup () {
24
- this .now = clock . UTCNow ()
23
+ this .now = utcNow ()
25
24
}
26
25
27
26
/////////////////////////////////////////////////////////////////////////////////
Original file line number Diff line number Diff line change @@ -2,8 +2,8 @@ package rabbitmq
2
2
3
3
import (
4
4
"strconv"
5
+ "time"
5
6
6
- "github.com/smartystreets/clock"
7
7
"github.com/smartystreets/logging"
8
8
"github.com/smartystreets/messaging/v2"
9
9
"github.com/streadway/amqp"
@@ -29,7 +29,7 @@ func newSubscription(
29
29
return & Subscription {
30
30
channel : channel ,
31
31
queue : queue ,
32
- consumer : strconv .FormatInt (clock . UTCNow ().UnixNano (), 10 ),
32
+ consumer : strconv .FormatInt (time . Now (). UTC ().UnixNano (), 10 ),
33
33
bindings : bindings ,
34
34
control : control ,
35
35
output : output ,
Original file line number Diff line number Diff line change 6
6
"time"
7
7
8
8
"github.com/smartystreets/assertions/should"
9
- "github.com/smartystreets/clock"
10
9
"github.com/smartystreets/gunit"
11
10
"github.com/smartystreets/logging"
12
11
"github.com/smartystreets/messaging/v2"
@@ -167,7 +166,7 @@ func (this *FakeSubscriptionChannel) DeclareQueue(name string) error {
167
166
return nil
168
167
}
169
168
func (this * FakeSubscriptionChannel ) DeclareTransientQueue () (string , error ) {
170
- return strconv .FormatInt (clock . UTCNow ().UnixNano (), 10 ), nil
169
+ return strconv .FormatInt (time . Now (). UTC ().UnixNano (), 10 ), nil
171
170
}
172
171
func (this * FakeSubscriptionChannel ) BindExchangeToQueue (queue string , exchange string ) error {
173
172
this .boundQueue = append (this .boundQueue , queue )
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ package rabbitmq
3
3
import (
4
4
"sync"
5
5
6
- "github.com/smartystreets/clock"
7
6
"github.com/smartystreets/logging"
8
7
"github.com/smartystreets/messaging/v2"
9
8
)
@@ -32,7 +31,7 @@ func (this *TransactionWriter) Write(message messaging.Dispatch) error {
32
31
// FUTURE: if error on publish, don't publish anything else
33
32
// until we reset the channel during commit
34
33
// opening a new channel is what marks it as able to continue
35
- dispatch := toAMQPDispatch (message , clock . UTCNow ())
34
+ dispatch := toAMQPDispatch (message , utcNow ())
36
35
return this .channel .PublishMessage (message .Destination , message .Partition , dispatch )
37
36
}
38
37
You can’t perform that action at this time.
0 commit comments