mirror of
https://github.com/discourse/discourse.git
synced 2026-08-06 13:08:40 +08:00
Previously, `CrawlerScorer` discounted a pageview by 40 points when its session reported human interaction, so a pageview scored before its engagement beacon settled could never have that credit applied. This change inverts the signal to penalize sessions with no measured interaction, raises `BEACON_SETTLE_PERIOD` to 30 minutes so engagement lands before scoring, and updates the built-in crawler data explorer reports to bucket on the 60-point threshold and to count only beacon pageviews.
19 lines
577 B
Ruby
Vendored
19 lines
577 B
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
RSpec.describe Jobs::DetectCrawlerPageviews do
|
|
it "does nothing when detection is disabled" do
|
|
SiteSetting.experimental_detect_crawler_pageviews = false
|
|
CrawlerScorer.expects(:score!).never
|
|
|
|
described_class.new.execute({})
|
|
end
|
|
|
|
it "scores a one hour wide window, held back by the beacon settle period" do
|
|
SiteSetting.experimental_detect_crawler_pageviews = true
|
|
freeze_time
|
|
|
|
CrawlerScorer.expects(:score!).with(window_start: 90.minutes.ago, window_end: 30.minutes.ago)
|
|
|
|
described_class.new.execute({})
|
|
end
|
|
end
|