Skip to content

Commit

Permalink
CV2-4713 flip notification logic (#1912)
Browse files Browse the repository at this point in the history
* CV2-4713 flip notification logic

* remove prints, add more context to notify
  • Loading branch information
DGaffney committed Jun 6, 2024
1 parent 2527878 commit a8ad509
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
1 change: 0 additions & 1 deletion app/models/bot/alegre.rb
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,6 @@ def self.transcribe_audio(pm)
def self.media_file_url(pm)
# FIXME Ugly hack to get a usable URL in docker-compose development environment.
if pm.is_a?(TemporaryProjectMedia)
print("HELLO")
url = pm.url
else
url = (ENV['RAILS_ENV'] != 'development' ? pm.media.file.file.public_url : "#{CheckConfig.get('storage_endpoint')}/#{CheckConfig.get('storage_bucket')}/#{pm.media.file.file.path}")
Expand Down
3 changes: 1 addition & 2 deletions app/models/concerns/alegre_v2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,6 @@ def get_items_with_similar_media_v2(args={})
type = args[:type]
if ['audio', 'image', 'video'].include?(type)
if project_media.nil?
print("hello")
project_media = TemporaryProjectMedia.new
project_media.url = media_url
project_media.id = Digest::MD5.hexdigest(project_media.url).to_i(16)
Expand All @@ -450,7 +449,7 @@ def get_items_with_similar_media_v2(args={})
sleep(1)
cached_data = get_cached_data(get_required_keys(project_media, nil))
end
CheckSentry.notify(AlegreTimeoutError.new('Timeout when waiting for async response from Alegre'), params: args.merge({ cached_data: cached_data })) if start_time + timeout > Time.now
CheckSentry.notify(AlegreTimeoutError.new('Timeout when waiting for async response from Alegre'), params: args.merge({ cached_data: cached_data.merge(time: Time.now, start_time: start_time, timeout: timeout) })) if start_time + timeout < Time.now
response = get_similar_items_v2_callback(project_media, nil)
delete(project_media, nil) if project_media.is_a?(TemporaryProjectMedia)
return response
Expand Down

0 comments on commit a8ad509

Please sign in to comment.