Improve uploader queue to respect queue size instead of waiting for idle #400
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.
Put this in a separate PR as it will be easier to review and manage any feedback.
See here for motivation (thanks @mknoedel!): https://github.com/JupiterOne/sdk/pull/396/files#r545299685
I also decided to make some additional changes to the behavior around when we allow additional tasks to be pushed into the queue. I think it makes more sense to not fail as fast as we can, but rather take the approach that we should upload as much data for a step as possible as we are already going to mark it as partial. The J1 synchronizer will handle edge cases that would cause issues (e.g. a relationship gets uploaded and one/both of the related entities failed to upload).
This idea is similar to the idea that we should be moving towards a world where integration steps do not fail fast in general (perhaps some cases where necessary, e.g. authentication failure). We should try to collect as much data as we can regardless of a failure. As long as the step is tracking these errors and ultimately throws at the end, we will be able to potentially upload a lot more data than we would have otherwise because of a single error. That is more of a bigger thought/development style change, but it has become particularly important in the Qualys integration where simply re-running the entire integration upon an intermittent failure (or even non-intermittent) is not a great option.