-
Notifications
You must be signed in to change notification settings - Fork 365
Ignore ResourceExists errors from bbs_apps_client #4522
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
base: main
Are you sure you want to change the base?
Conversation
rescue CloudController::Errors::ApiError => e # catch race condition if Diego Process Sync creates an LRP in the meantime | ||
if e.name == 'RunnerError' && e.message['the requested resource already exists'] | ||
existing_lrp = client.get_app(process) | ||
client.update_app(process, existing_lrp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do lose out on this update. I think the syncer will get to it anyway (or already got to it, since this is a race condition). I'll think about it some more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, looking at client.update_app
, it's getting the LRP based on the CC process's guid
and version
. If the version
s match between the LRP and the CC process, then no update is needed (that's the purpose of version
).
Thus, I don't think this additional update is needed.
Discovered while reviewing #4452 |
Reproduction steps:
|
- This is a re-implementation of 133486e - This error can be raised by BBS when there is a race condition between the CC syncer and CC API when creating an LRP for a process - Since we want to desire a process anyway, it already existing (with the correct version) is likely not an error case. Thus, we can behave idempotently. - Improvements from previous implementation: - No longer ignores other types of APIErrors in desire_app_handler.rb - No longer coupled to the exact error message coming from BBS
3e52839
to
c2d496a
Compare
Previous: ``` "error":{"descriptor":[{},{}]}} ``` Improved: ``` "error":"\u003cDiego::Bbs::Models::Error: type: :ResourceExists, message: \"the requested resource already exists\"\u003e" ```
Manual testing
Results:
|
the CC syncer and CC API when creating an LRP for a process
the correct version) is likely not an error case. Thus, we can behave
idempotently.
desire_app_handler.rb