-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from yunkon-kim/240503-15
Provide the API to check system readiness instead of `health`
- Loading branch information
Showing
7 changed files
with
104 additions
and
60 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package readyz | ||
|
||
import ( | ||
"sync/atomic" | ||
) | ||
|
||
// isSystemReady is declared as an atomic.Value to ensure thread safety. | ||
var isSystemReady atomic.Value | ||
|
||
// init function initializes isSystemReady with its default value. | ||
func init() { | ||
isSystemReady.Store(false) // Initialize as the system is not ready. | ||
} | ||
|
||
// IsReady returns the current readiness status of the system. | ||
func IsReady() bool { | ||
return isSystemReady.Load().(bool) | ||
} | ||
|
||
// SetReady sets the readiness status of the system. | ||
func SetReady(ready bool) { | ||
isSystemReady.Store(ready) | ||
} |