Skip to content

Commit

Permalink
use passed context for GetTicketInfo stakepoold rpc call
Browse files Browse the repository at this point in the history
  • Loading branch information
itswisdomagain committed Mar 19, 2020
1 parent be5e840 commit ae0e4ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion controllers/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ type tStakepooldManager struct {
qItem func() queueItem
}

func (m *tStakepooldManager) GetTicketInfo(hash string) (*pb.GetTicketInfoResponse, error) {
func (m *tStakepooldManager) GetTicketInfo(_ context.Context, hash string) (*pb.GetTicketInfoResponse, error) {
item := m.qItem()
thing, _ := item.thing.(*pb.GetTicketInfoResponse)
return thing, item.err
Expand Down
6 changes: 3 additions & 3 deletions stakepooldclient/stakepooldclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var (

// Manager is satisfied by stakepooldManager.
type Manager interface {
GetTicketInfo(hash string) (*pb.GetTicketInfoResponse, error)
GetTicketInfo(ctx context.Context, hash string) (*pb.GetTicketInfoResponse, error)
GetAddedLowFeeTickets(context.Context) (map[chainhash.Hash]string, error)
GetIgnoredLowFeeTickets(context.Context) (map[chainhash.Hash]string, error)
GetLiveTickets(context.Context) (map[chainhash.Hash]string, error)
Expand Down Expand Up @@ -138,10 +138,10 @@ func (s *stakepooldManager) connected(ctx context.Context) error {
// GetTicketInfo performs gRPC GetTicketInfo requests against
// all stakepoold instances and returns the first result fetched
// without errors. Returns an error if all RPC requests fail.
func (s *stakepooldManager) GetTicketInfo(hash string) (*pb.GetTicketInfoResponse, error) {
func (s *stakepooldManager) GetTicketInfo(ctx context.Context, hash string) (*pb.GetTicketInfoResponse, error) {
for _, conn := range s.grpcConnections {
client := pb.NewStakepooldServiceClient(conn)
resp, err := client.GetTicketInfo(context.Background(), &pb.GetTicketInfoRequest{Hash: hash})
resp, err := client.GetTicketInfo(ctx, &pb.GetTicketInfoRequest{Hash: hash})
if err != nil {
log.Warnf("GetTicketInfo RPC failed on stakepoold instance %s: %v", conn.Target(), err)
continue
Expand Down

0 comments on commit ae0e4ce

Please sign in to comment.