avoid marking non-existent project as indexed in the webapp #4800
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.
This change gets rid of the warning message for newly discovered projects during indexer run.
I contemplated various solutions:
prepareIndexer()
(too complex and would not reflect real webapp state)In the end the code retrieves the current list of projects known to the webapp. While this may seem a bit heavy, because this will be done for each indexed project, the webapp should withstand the traffic just fine and I wanted to avoid stashing the list in
RuntimeEnvironment
or somewhere in theIndexer
and passing it around toIndexDatabase
. Of course, I could have introduced new API end point to check for project existence, however deemed this unnecessary at this point.Naturally, there is a time window between the check and the eventual mark-as-indexed operation, however let's assume the chance of the project to be deleted in that window is negligible.
While there, I refactored the code which performs the API call to mark the project as indexed into
IndexerUtil
.