1
0
Fork 0
mirror of https://github.com/eosswedenorg/thalos synced 2026-07-03 11:53:41 +02:00

cmd/thalos/main.go: in readerLoop() make sure we set shClient.StartBlock to processor's current block when (re)connecting.

This commit is contained in:
Henrik Hautakoski 2023-08-21 14:10:38 +02:00
parent 6ef3daeecf
commit 6c61382f4c

View file

@ -44,7 +44,7 @@ var VersionString string = "dev"
var exit chan bool var exit chan bool
func readerLoop() { func readerLoop(processor *app.ShipProcessor) {
running = true running = true
recon_cnt := 0 recon_cnt := 0
@ -75,6 +75,11 @@ func readerLoop() {
return err return err
} }
// Set stream client start block to processors current block
// Both values should be the same on first connect, but when reconnecting
// We don't want to start from the beginning
shClient.StartBlock = processor.GetCurrentBlock()
return shClient.SendBlocksRequest() return shClient.SendBlocksRequest()
} }
@ -118,9 +123,9 @@ func readerLoop() {
} }
} }
func run() { func run(processor *app.ShipProcessor) {
// Spawn reader loop in another thread. // Spawn reader loop in another thread.
go readerLoop() go readerLoop(processor)
// Create interrupt channel. // Create interrupt channel.
signals := make(chan os.Signal, 1) signals := make(chan os.Signal, 1)
@ -295,7 +300,7 @@ func main() {
) )
// Run the application // Run the application
run() run(processor)
// Close the processor properly // Close the processor properly
processor.Close() processor.Close()