refactor: move check to first step of function (#14640)
This commit is contained in:
parent
6887e1db71
commit
79b82c0c12
@ -51,6 +51,13 @@ func NewStreamingService(
|
||||
logger log.Logger,
|
||||
outputMetadata, stopNodeOnErr, fsync bool,
|
||||
) (*StreamingService, error) {
|
||||
// Check that the writeDir exists and is writable so that we can catch the
|
||||
// error here at initialization. If it is not we don't open a dstFile until we
|
||||
// receive our first ABCI message.
|
||||
if err := isDirWriteable(writeDir); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// sort storeKeys for deterministic output
|
||||
sort.SliceStable(storeKeys, func(i, j int) bool {
|
||||
return storeKeys[i].Name() < storeKeys[j].Name()
|
||||
@ -62,13 +69,6 @@ func NewStreamingService(
|
||||
listeners[i] = types.NewMemoryListener(key)
|
||||
}
|
||||
|
||||
// Check that the writeDir exists and is writable so that we can catch the
|
||||
// error here at initialization. If it is not we don't open a dstFile until we
|
||||
// receive our first ABCI message.
|
||||
if err := isDirWriteable(writeDir); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &StreamingService{
|
||||
storeListeners: listeners,
|
||||
filePrefix: filePrefix,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user