Skip to content

Conversation

@g-linville
Copy link
Member

Signed-off-by: Grant Linville <[email protected]>
drpebcak
drpebcak previously approved these changes Mar 12, 2025
Comment on lines 241 to 265
s.recreateAllLock.Lock()
authConfig, err := store.Get(serverAddress)
if err != nil {
s.recreateAllLock.Unlock()

if IsCredentialsNotFoundError(err) {
// This can happen if the credential was deleted between the GetAll and the Get by another thread.
continue
}
return err
}

if err := store.Erase(serverAddress); err != nil {
s.recreateAllLock.Unlock()
return err
}

if err := store.Store(authConfig); err != nil {
s.recreateAllLock.Unlock()
return err
}
s.recreateAllLock.Unlock()
}

return nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Writing a helper function for this will allow you to use defer s.recreateAllLock.Unlock().

Copy link
Member Author

Choose a reason for hiding this comment

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

oh good call

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

njhale
njhale previously approved these changes Mar 13, 2025
Copy link
Member

@njhale njhale left a comment

Choose a reason for hiding this comment

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

lgtm once Donnie's feedback is addressed.

Signed-off-by: Grant Linville <[email protected]>
@g-linville g-linville dismissed stale reviews from njhale and drpebcak via dad6e3a March 13, 2025 18:40
@g-linville g-linville requested a review from thedadams March 13, 2025 18:41
@g-linville g-linville requested review from drpebcak and njhale March 13, 2025 19:35
@g-linville g-linville merged commit cee1a75 into gptscript-ai:main Mar 14, 2025
10 checks passed
@g-linville g-linville deleted the recreate-credentials branch March 14, 2025 15:00
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.

4 participants