lib/contrast/utils/invalid_configuration_util.rb in contrast-agent-3.12.2 vs lib/contrast/utils/invalid_configuration_util.rb in contrast-agent-3.13.0
- old
+ new
@@ -42,31 +42,15 @@
finding.preflight = Contrast::Utils::PreflightUtil.create_preflight(finding)
activity = Contrast::Api::Dtm::Activity.new
activity.findings << finding
- # If assess is enabled, we can just send the activity
- if APP_CONTEXT.ready?
- build_tags(activity)
- Contrast::Utils::ServiceSenderUtil.push_to_ready_queue activity
- # Otherwise, if the Agent isn't ready, we have to queue the messages
- # until we know the starting state.
- else
- Contrast::Utils::ServiceSenderUtil.add_to_assess_messages activity
- end
+ Contrast::Agent.messaging_queue.send_event_eventually(activity)
rescue StandardError => e
logger.error('Unable to build a finding', e, rule: rule_id)
end
private
-
- # This seems silly to pull out, but we can ONLY call this in the case
- # where we have a configuration. Doing otherwise results in a bad error
- # case where we try to do other things, like logging, which behave
- # strangely without a config
- def build_tags activity
- activity.finding_tags = Contrast::Utils::StringUtils.force_utf8(ASSESS.tags)
- end
def file_snippet file_path, call_location
idx = call_location&.lineno
if file_path && idx && File.exist?(file_path)
idx = idx > 5 ? idx - 5 : 0