workers: More review related fixes

This commit is contained in:
Łukasz Magiera 2020-03-25 00:37:40 +01:00
parent cd892105f6
commit d8f357b01c
5 changed files with 7 additions and 4 deletions

View File

@ -20,7 +20,7 @@ var FsOverheadFinalized = map[sectorbuilder.SectorFileType]int{
type Resources struct { type Resources struct {
MinMemory uint64 // What Must be in RAM for decent perf MinMemory uint64 // What Must be in RAM for decent perf
MaxMemory uint64 // Mamory required (swap + ram) MaxMemory uint64 // Memory required (swap + ram)
MultiThread bool MultiThread bool
CanGPU bool CanGPU bool

View File

@ -15,7 +15,7 @@ type readonlyProvider struct {
} }
func (l *readonlyProvider) AcquireSector(ctx context.Context, id abi.SectorID, existing sectorbuilder.SectorFileType, allocate sectorbuilder.SectorFileType, sealing bool) (sectorbuilder.SectorPaths, func(), error) { func (l *readonlyProvider) AcquireSector(ctx context.Context, id abi.SectorID, existing sectorbuilder.SectorFileType, allocate sectorbuilder.SectorFileType, sealing bool) (sectorbuilder.SectorPaths, func(), error) {
if allocate != 0 { if allocate != 0 { // 0 - don't allocate anything
return sectorbuilder.SectorPaths{}, nil, xerrors.New("read-only storage") return sectorbuilder.SectorPaths{}, nil, xerrors.New("read-only storage")
} }

View File

@ -14,7 +14,7 @@ func ParseSectorID(baseName string) (abi.SectorID, error) {
var mid abi.ActorID var mid abi.ActorID
read, err := fmt.Sscanf(baseName, "s-t0%d-%d", &mid, &n) read, err := fmt.Sscanf(baseName, "s-t0%d-%d", &mid, &n)
if err != nil { if err != nil {
return abi.SectorID{}, xerrors.Errorf(": %w", err) return abi.SectorID{}, xerrors.Errorf("sscanf sector name ('%s'): %w", baseName, err)
} }
if read != 2 { if read != 2 {

View File

@ -68,11 +68,13 @@ func (handler *FetchHandler) remoteGetSector(w http.ResponseWriter, r *http.Requ
ft, err := ftFromString(vars["type"]) ft, err := ftFromString(vars["type"])
if err != nil { if err != nil {
log.Error("%+v", err) log.Error("%+v", err)
w.WriteHeader(500)
return return
} }
paths, _, done, err := handler.Local.AcquireSector(r.Context(), id, ft, 0, false) paths, _, done, err := handler.Local.AcquireSector(r.Context(), id, ft, 0, false)
if err != nil { if err != nil {
log.Error("%+v", err) log.Error("%+v", err)
w.WriteHeader(500)
return return
} }
defer done() defer done()
@ -126,6 +128,7 @@ func (handler *FetchHandler) remoteDeleteSector(w http.ResponseWriter, r *http.R
ft, err := ftFromString(vars["type"]) ft, err := ftFromString(vars["type"])
if err != nil { if err != nil {
log.Error("%+v", err) log.Error("%+v", err)
w.WriteHeader(500)
return return
} }

View File

@ -273,7 +273,7 @@ func (r *Remote) FsStat(ctx context.Context, id ID) (FsStat, error) {
return FsStat{}, xerrors.Errorf("fsstat: got http 500, then failed to read the error: %w", err) return FsStat{}, xerrors.Errorf("fsstat: got http 500, then failed to read the error: %w", err)
} }
return FsStat{}, xerrors.New(string(b)) return FsStat{}, xerrors.Errorf("fsstat: got http 500: %s", string(b))
} }
var out FsStat var out FsStat