Skip to content

Commit

Permalink
Made it so that the porter doesn't panic if it can't get an entry
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePiachu committed Feb 21, 2017
1 parent 2829ea0 commit d51de84
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Utilities/DatabasePorter/api.go
Expand Up @@ -106,7 +106,7 @@ func GetEBlock(keymr string) (interfaces.IEntryBlock, error) {
}

func GetEntry(hash string) (interfaces.IEBEntry, error) {
for i := 0; i < 100; i++ {
for i := 0; i < 10; i++ {
raw, err := GetRaw(hash)
if err != nil {
fmt.Printf("got error %s\n", err)
Expand All @@ -130,7 +130,7 @@ func GetEntry(hash string) (interfaces.IEBEntry, error) {
}
return entry, nil
}
panic("Failed 100 times to get the data " + hash)
//panic("Failed 100 times to get the data " + hash)
return nil, nil
}

Expand Down
9 changes: 5 additions & 4 deletions Utilities/DatabasePorter/porter.go
Expand Up @@ -267,10 +267,11 @@ func SaveBlocksLoop(input chan []interfaces.IDirectoryBlock, done chan int) {
fmt.Printf("Problem getting entry `%v` from block %v\n", ehash.String(), e.GetKeyMR().String())
panic(err)
}

blockSet.Mutex.Lock()
blockSet.Entries = append(blockSet.Entries, entry)
blockSet.Mutex.Unlock()
if entry != nil {
blockSet.Mutex.Lock()
blockSet.Entries = append(blockSet.Entries, entry)
blockSet.Mutex.Unlock()
}
}(eHash)
}
for range eBlockEntries {
Expand Down

0 comments on commit d51de84

Please sign in to comment.