fix: improve error handling for deleted apps#413
Open
Conversation
sbylica-splunk
requested changes
Mar 25, 2026
| // Not able to find the app from remote. App may be deleted. | ||
| // Check if the app is available in boltdb cache | ||
|
|
||
| if IsResourceNotFound(err) { |
Collaborator
There was a problem hiding this comment.
I think this branch never happens, we replace this error with ErrMissingAndIgnored during AnnotateWithAppData higher up.
| Context("When orphan app is requested", func() { | ||
|
|
||
| It("Should found app in cache", func() { | ||
| It("Should not find deleted app after cache invalidation", func() { |
Collaborator
There was a problem hiding this comment.
I don't really get it, so previously if orphan app was requested it would be found in cache anyway?
| if IsResourceNotFound(err) { | ||
| // App is confirmed deleted by CF — clean up stale BoltDB entry | ||
| // and record in missingApps so we don't keep hitting the API. | ||
| c.removeAppFromDatabase(appGuid) |
Collaborator
There was a problem hiding this comment.
Should have logger message imo
| } | ||
|
|
||
| func (c *Boltdb) removeAppFromDatabase(appGuid string) { | ||
| c.appdb.Update(func(tx *bolt.Tx) error { |
Collaborator
There was a problem hiding this comment.
Probably a log message here too
| } | ||
| return nil | ||
| }) | ||
| for _, k := range staleKeys { |
Collaborator
There was a problem hiding this comment.
Error handling here?
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix excessive log noise when the nozzle processes firehose events referencing deleted CF apps. Previously, every event for a deleted app produced a log line — either an ERROR (when IsResourceNotFound failed to match) or a repeated INFO. With high event volume, this could generate thousands of identical log entries per deleted app.
Changes
cache/boltdb.go
events/events.go