This repository has been archived by the owner on Oct 18, 2023. It is now read-only.
forked from erigontech/erigon
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore graceful shutdown (erigontech#591)
* initial * gracefull shutdown for staged * more wg fixes * fmt * linters * remove generalization * linters * linters * fix * fix * fmt * quit into etl * after CR * after CR
- Loading branch information
Showing
15 changed files
with
239 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
*/**/*tx_database* | ||
*/**/*dapps* | ||
build/_vendor/pkg | ||
/*.a | ||
|
||
#* | ||
.#* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package common | ||
|
||
import "errors" | ||
|
||
var ErrStopped = errors.New("stopped") | ||
|
||
func Stopped(ch chan struct{}) error { | ||
if ch == nil { | ||
return nil | ||
} | ||
select { | ||
case <-ch: | ||
return ErrStopped | ||
default: | ||
} | ||
return nil | ||
} | ||
|
||
func SafeClose(ch chan struct{}) { | ||
if ch == nil { | ||
return | ||
} | ||
select { | ||
case <-ch: | ||
// Channel was already closed | ||
default: | ||
close(ch) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.