This repository was archived by the owner on Jul 22, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +2
-34
lines changed Expand file tree Collapse file tree 3 files changed +2
-34
lines changed Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
33module ::Jobs
4- class UpdateHotTopicGist < ::Jobs ::Base
4+ class FastTrackTopicGist < ::Jobs ::Base
55 sidekiq_options retry : false
66
77 def execute ( args )
@@ -12,8 +12,6 @@ def execute(args)
1212 topic = Topic . find_by ( id : args [ :topic_id ] )
1313 return if topic . blank?
1414
15- return if !TopicHotScore . where ( topic : topic ) . exists?
16-
1715 summarizer = DiscourseAi ::Summarization . topic_gist ( topic )
1816 gist = summarizer . existing_summary
1917 return if gist . blank?
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -35,20 +35,12 @@ def inject_into(plugin)
3535 object . ai_gist_summary &.summarized_text
3636 end
3737
38- # To make sure hot topic gists are inmediately up to date, we rely on this event
39- # instead of using a scheduled job.
40- plugin . on ( :topic_hot_scores_updated ) { Jobs . enqueue ( :hot_topics_gist_batch ) }
41-
4238 # As this event can be triggered quite often, let's be overly cautious enqueueing
4339 # jobs if the feature is disabled.
4440 plugin . on ( :post_created ) do |post |
4541 if SiteSetting . discourse_ai_enabled && SiteSetting . ai_summarization_enabled &&
4642 SiteSetting . ai_summarize_max_hot_topics_gists_per_batch > 0 && post . topic
47- hot_score = TopicHotScore . find_by ( topic : post . topic )
48-
49- if hot_score . present? && hot_score . updated_at > 1 . day . ago
50- Jobs . enqueue ( :update_hot_topic_gist , topic_id : post &.topic_id )
51- end
43+ Jobs . enqueue ( :fast_track_topic_gist , topic_id : post &.topic_id )
5244 end
5345 end
5446 end
You can’t perform that action at this time.
0 commit comments