Skip to content

Commit

Permalink
Fix work_cancel bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Berhent committed Aug 15, 2022
1 parent e613594 commit 7993e8a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/client/websocket/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func (ws *WebsocketService) StartWSClient(ctx context.Context, workQueueChan cha
// If the backlog is too large, no-op
if queue.Len() > 99 {
fmt.Printf("\nBacklog is too large, skipping hash %s", serverMsg.Hash)
continue
}

// Queue this work
Expand All @@ -87,8 +88,7 @@ func (ws *WebsocketService) StartWSClient(ctx context.Context, workQueueChan cha
} else if serverMsg.MessageType == serializableModels.WorkCancel {
// Delete pending work from queue
// ! TODO - can we cancel currently runing work calculations?
var workCancelCmd serializableModels.ClientMessage
queue.Delete(workCancelCmd.Hash)
queue.Delete(serverMsg.Hash)
} else if serverMsg.MessageType == serializableModels.BlockAwarded {
fmt.Printf("\n💰 Received block awarded %s", serverMsg.Hash)
fmt.Printf("\n💰 Your current estimated next payout is %f%% or %f BAN", serverMsg.PercentOfPool, serverMsg.EstimatedAward)
Expand Down

0 comments on commit 7993e8a

Please sign in to comment.