mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2024-12-26 16:25:18 +00:00
Fix sync state machine issue for sharding case (#102)
* Fix sync state machine issue for sharding case * Fix fmt lint
This commit is contained in:
parent
2f3361fafc
commit
055d1fa32d
@ -561,7 +561,10 @@ impl SerialSyncController {
|
|||||||
while !completed {
|
while !completed {
|
||||||
match self.state {
|
match self.state {
|
||||||
SyncState::Idle => {
|
SyncState::Idle => {
|
||||||
if self.peers.count(&[Found, Connecting, Connected]) > 0 {
|
if self
|
||||||
|
.peers
|
||||||
|
.all_shards_available(vec![Found, Connecting, Connected])
|
||||||
|
{
|
||||||
self.state = SyncState::FoundPeers;
|
self.state = SyncState::FoundPeers;
|
||||||
} else {
|
} else {
|
||||||
self.try_find_peers();
|
self.try_find_peers();
|
||||||
@ -569,7 +572,10 @@ impl SerialSyncController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SyncState::FindingPeers { since, .. } => {
|
SyncState::FindingPeers { since, .. } => {
|
||||||
if self.peers.count(&[Found, Connecting, Connected]) > 0 {
|
if self
|
||||||
|
.peers
|
||||||
|
.all_shards_available(vec![Found, Connecting, Connected])
|
||||||
|
{
|
||||||
self.state = SyncState::FoundPeers;
|
self.state = SyncState::FoundPeers;
|
||||||
} else {
|
} else {
|
||||||
// storage node may not have the specific file when `FindFile`
|
// storage node may not have the specific file when `FindFile`
|
||||||
|
Loading…
Reference in New Issue
Block a user