Skip to content

Conversation

@guggero
Copy link
Contributor

@guggero guggero commented Apr 26, 2021

To make sure we don't just block for forever if another Loop daemon
process is already running, we add a timeout and error out if obtaining
the unique file lock fails after 5 seconds.

Pull Request Checklist

  • Update release_notes.md if your PR contains major features, breaking changes or bugfixes

@guggero guggero requested review from a team, Roasbeef, carlaKC and yyforyongyu and removed request for a team and Roasbeef April 26, 2021 13:53
Copy link
Member

@yyforyongyu yyforyongyu left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@carlaKC carlaKC left a comment

Choose a reason for hiding this comment

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

Great addition! Just some nittyness around where the user-instructive/ terminal-specific error should live.

loopdb.DefaultLoopDBTimeout, macaroons.IPLockChecker,
)
if err == bbolt.ErrTimeout {
return fmt.Errorf("error while trying to open %s/%s: "+
Copy link
Contributor

Choose a reason for hiding this comment

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

Great explanatory error!

Just wondering where these errors should live. startMacaroonService and NewBoltSwapStore are both called from our initialize function for the daemon. WDYT about bubbling the bbolt.ErrTimeout all the way up (or wrap it so that we can also have the db name), and then we can have a single descriptive error in the daemon?

If we do it like that, the terminal-specific instructions could also be handled in terminal by checking the response for StartAsSubserver's response.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I've implemented your suggestion. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks great!

To make sure we don't just block for forever if another Loop daemon
process is already running, we add a timeout and error out if obtaining
the unique file lock fails after 5 seconds.
Copy link
Contributor

@carlaKC carlaKC left a comment

Choose a reason for hiding this comment

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

Thanks for updating! LGTM

@guggero guggero merged commit 9fe7ab1 into lightninglabs:master Apr 29, 2021
@guggero guggero deleted the db-timeout branch April 29, 2021 07:26
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.

3 participants