Skip to content

Commit fd0bb51

Browse files
committed
Replace reconnect() with disconnect()
1 parent 677391f commit fd0bb51

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

core/connection/manager.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,8 +1056,8 @@ func (m *connectionManager) monitorPrice(currentPrice market.Price, proposalLook
10561056
hourDrop := float64(currentPrice.PricePerHour.Int64()-newPrice.PricePerHour.Int64()) / float64(currentPrice.PricePerHour.Int64())
10571057

10581058
if giBDrop*100 >= m.priceDropPercent || hourDrop*100 >= m.priceDropPercent {
1059-
log.Info().Msgf("Price dropped significantly from %q to %q, reconnecting", currentPrice.String(), newPrice.String())
1060-
m.Reconnect()
1059+
log.Info().Msgf("Price dropped significantly from %q to %q, disconnecting", currentPrice.String(), newPrice.String())
1060+
m.Disconnect()
10611061
return
10621062
}
10631063
}

core/connection/manager_test.go

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ func (tc *testContext) TestConnectMethodReturnsErrorIfConnectionExitsDuringConne
392392
assert.Equal(tc.T(), ErrConnectionFailed, err)
393393
}
394394

395-
func (tc *testContext) TestReconnectDueToPriceDrop() {
395+
func (tc *testContext) TestDisconnectDueToPriceDrop() {
396396
tc.fakeConnectionFactory.mockConnection.onStartReportStates = []fakeState{
397397
connectedState,
398398
}
@@ -419,17 +419,7 @@ func (tc *testContext) TestReconnectDueToPriceDrop() {
419419

420420
waitABit()
421421

422-
disconnect := false
423-
for _, event := range tc.stubPublisher.GetEventHistory() {
424-
if event.Topic == connectionstate.AppTopicConnectionState &&
425-
event.Event.(connectionstate.AppEventConnectionState).State == connectionstate.Disconnecting {
426-
disconnect = true
427-
break
428-
}
429-
}
430-
assert.True(tc.T(), disconnect)
431-
assert.Equal(tc.T(), connectionstate.Connected, tc.connManager.Status().State)
432-
assert.Equal(tc.T(), newPrice, tc.connManager.Status().Proposal.Price)
422+
assert.Equal(tc.T(), connectionstate.NotConnected, tc.connManager.Status().State)
433423
}
434424

435425
func (tc *testContext) Test_PaymentManager_WhenManagerMadeConnectionIsStarted() {

0 commit comments

Comments
 (0)