fix: Sentiment analysis queue update (#7552)

This commit is contained in:
Tejaswini Chile
2023-07-19 20:27:20 +05:30
committed by GitHub
parent 8babf7dec3
commit f3f665cabb
3 changed files with 10 additions and 8 deletions

View File

@@ -1,5 +1,5 @@
class Enterprise::SentimentAnalysisJob < ApplicationJob
queue_as :default
queue_as :low
def perform(message)
return if message.account.locale != 'en'
@@ -27,11 +27,11 @@ class Enterprise::SentimentAnalysisJob < ApplicationJob
# Model initializes OnnxRuntime::Model, with given file for inference session and to create the tensor
def model
model = save_and_open_sentiment_file
model_file = save_and_open_sentiment_file
return if File.empty?(model)
return if File.empty?(model_file)
Informers::SentimentAnalysis.new(model)
Informers::SentimentAnalysis.new(model_file)
end
def label_val(sentiment)

View File

@@ -1,5 +1,5 @@
module Enterprise::Message
def update_message_sentiments
::Enterprise::SentimentAnalysisJob.perform_later(self)
::Enterprise::SentimentAnalysisJob.perform_later(self) if ENV.fetch('SENTIMENT_FILE_PATH', nil)
end
end