Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make hostname stable, check if sonic is initialized #89

Closed
wants to merge 141 commits into from

Conversation

majst01
Copy link
Contributor

@majst01 majst01 commented Feb 28, 2023

This requires also to set hostname during metal-core deployment, will be done next.
Fallback is still os.Hostname()

depend on metal-stack/metal-roles#155

TODO:

  • startup works as before

@majst01 majst01 requested a review from a team as a code owner February 28, 2023 15:33
@majst01 majst01 changed the base branch from sonic-redis to master March 1, 2023 06:25
@majst01 majst01 changed the base branch from master to sonic-redis March 1, 2023 06:43
return fmt.Errorf("switch is not yet initialized, retrying")
},
retry.Attempts(20),
retry.Delay(1*time.Second),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My gut tells me that twenty seconds may be too low. Maybe one minute?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DefaultDelayType = CombineDelay(BackOffDelay, RandomDelay)
so the delay basically doubles on every try ... with 20 attempts this would result at the end to a couple of weeks? :-)

@@ -40,6 +40,15 @@ func newConfigDB(addr string, id int, separator string) *ConfigDB {
}
}

func (c *ConfigDB) IsInitialized(ctx context.Context) (bool, error) {
key := "CONFIG_DB_INITIALIZED"
result, err := c.rdb.Get(ctx, key).Result()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get will return an error of type redis.Nil if the key doesn't exist. We should use Exists.

Base automatically changed from sonic-redis to master May 16, 2023 08:04
@majst01
Copy link
Contributor Author

majst01 commented May 16, 2023

not required anymore since #81 was merged

@majst01 majst01 closed this May 16, 2023
@majst01 majst01 deleted the initialized-and-hostname branch May 16, 2023 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants