Small repairs on logic
This commit is contained in:
@@ -14,16 +14,12 @@ const BINS_FILE = "data/bins.json"
|
||||
func (t *TorrentManager) initializeBins() {
|
||||
if _, err := os.Stat(BINS_FILE); os.IsNotExist(err) {
|
||||
t.repairLog.Info("data/bins.json does not exist. Initializing empty bins.")
|
||||
t.ImmediateBin = mapset.NewSet[string]()
|
||||
t.OnceDoneBin = mapset.NewSet[string]()
|
||||
return
|
||||
}
|
||||
|
||||
fileData, err := os.ReadFile(BINS_FILE)
|
||||
if err != nil {
|
||||
t.repairLog.Errorf("Failed to read bins.json file: %v", err)
|
||||
t.ImmediateBin = mapset.NewSet[string]()
|
||||
t.OnceDoneBin = mapset.NewSet[string]()
|
||||
t.repairLog.Errorf("Failed to read bins.json file: %v Initializing empty bins.", err)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -31,9 +27,7 @@ func (t *TorrentManager) initializeBins() {
|
||||
|
||||
err = json.Unmarshal(fileData, &data)
|
||||
if err != nil {
|
||||
t.repairLog.Errorf("Failed to unmarshal bin data: %v", err)
|
||||
t.ImmediateBin = mapset.NewSet[string]()
|
||||
t.OnceDoneBin = mapset.NewSet[string]()
|
||||
t.repairLog.Errorf("Failed to unmarshal bin data: %v Initializing empty bins.", err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user