Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit 1ce25c5

Browse files
authored
DEV: Don't classify post sentiments on creation. (#1174)
We'll rely on the backfill instead, which runs every five minutes. Bump default batch size x10 to avoid lagging.
1 parent 1b570fc commit 1ce25c5

File tree

3 files changed

+1
-24
lines changed

3 files changed

+1
-24
lines changed

config/settings.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ discourse_ai:
1818
default: ""
1919
json_schema: DiscourseAi::Sentiment::SentimentSiteSettingJsonSchema
2020
ai_sentiment_backfill_maximum_posts_per_hour:
21-
default: 250
21+
default: 2500
2222
min: 0
2323
max: 10000
2424
hidden: true

lib/sentiment/entry_point.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ def inject_into(plugin)
1111
end
1212
end
1313

14-
plugin.on(:post_created, &sentiment_analysis_cb)
1514
plugin.on(:post_edited, &sentiment_analysis_cb)
1615

1716
plugin.add_to_serializer(:current_user, :can_see_sentiment_reports) do

spec/lib/modules/sentiment/entry_point_spec.rb

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,6 @@
66
fab!(:user) { Fabricate(:user, refresh_auto_groups: true) }
77

88
describe "registering event callbacks" do
9-
context "when creating a post" do
10-
let(:creator) do
11-
PostCreator.new(
12-
user,
13-
raw: "this is the new content for my topic",
14-
title: "this is my new topic title",
15-
)
16-
end
17-
18-
it "queues a job on create if sentiment analysis is enabled" do
19-
SiteSetting.ai_sentiment_enabled = true
20-
21-
expect { creator.create }.to change(Jobs::PostSentimentAnalysis.jobs, :size).by(1)
22-
end
23-
24-
it "does nothing if sentiment analysis is disabled" do
25-
SiteSetting.ai_sentiment_enabled = false
26-
27-
expect { creator.create }.not_to change(Jobs::PostSentimentAnalysis.jobs, :size)
28-
end
29-
end
30-
319
context "when editing a post" do
3210
fab!(:post) { Fabricate(:post, user: user) }
3311
let(:revisor) { PostRevisor.new(post) }

0 commit comments

Comments
 (0)