DEV Community

MiY
MiY

Posted on

Time-sensitive publishing without letting AI flood the site

A daily publishing cap is useful until the day it blocks a result that will be stale in three hours.

We run a six-language news site. Collection, drafting, translation, fact checks, and static builds are automated. The same cap that protects the site from low-value volume can also hold back a sports result, an election call, or a weather disruption until the next day.

The fix was not to remove the cap. It was to separate two questions:

  1. How much ordinary publishing should happen today?
  2. Is this particular story time-sensitive?

Those are different decisions. Mixing them into one counter made the pipeline conservative in the wrong places.

The first version

The initial quota was simple: count auto-published article groups since midnight in Asia/Tokyo. If the number reached 15, stop publishing for the day. A smaller hot-source quota and public-source quota sat underneath it.

That worked for evergreen public notices and feature stories. It failed for anything with a short shelf life.

A sports result published 16 hours after the match is not the same product as a city-hall notice published 16 hours after an update. The first one has already lost most of its value.

Add a timeliness score at ingestion

Every collected item now gets a time_sensitive_score before drafting starts. The score combines:

  • source category
  • age of the source item
  • multilingual time and impact signals

A trimmed version of the scorer:

const CATEGORY_WEIGHTS = {
  sports: 5,
  politics: 4,
  business: 4,
  environment: 3,
  society: 2,
  local: 2,
  culture: 2,
  tech: 1,
};

const SIGNALS = [
  { key: "breaking", weight: 4 },
  { key: "disaster", weight: 5 },
  { key: "election", weight: 3, categories: ["politics"] },
  { key: "sports_result", weight: 3, categories: ["sports"] },
  { key: "market", weight: 2, categories: ["business"] },
  { key: "deadline", weight: 3, categories: ["politics", "business", "local", "culture"] },
];

export function detectTimeSensitivity({ source, item }) {
  const age = hoursSince(item.published_at || item.fetched_at);
  const recency = age <= 2 ? 5 : age <= 6 ? 3 : age <= 24 ? 1 : 0;
  const category = source.category || "";
  const hot = Number(source.is_trending_source) === 1 ? 2 : 0;

  let signalScore = 0;
  const hits = [];
  for (const signal of SIGNALS) {
    if (signal.categories && !signal.categories.includes(category)) continue;
    if (matches(item, signal.key)) {
      signalScore += signal.weight;
      hits.push(signal.key);
    }
  }

  const score = Math.min(
    30,
    (CATEGORY_WEIGHTS[category] || 0) + recency + hot + signalScore,
  );

  return {
    score,
    timeSensitive: score >= 10 || category === "sports" && age <= 48,
    reasons: [category, ...hits],
  };
}
Enter fullscreen mode Exit fullscreen mode

The real version has multilingual term lists for Japanese, Korean, Thai, Vietnamese, Indonesian, and English. It also has category guards:

  • sports_result only counts for sports sources
  • election only counts for politics
  • market only counts for business
  • deadline only counts for categories where deadlines change reader behaviour

Those guards matter. Without them, a technology article containing the word “final” gets treated as a sports result.

Separate quotas

A time-sensitive group can bypass the ordinary daily cap, the hot-source cap, and the public-source cap. It still has its own daily cap:

automation_daily_time_sensitive_limit=10
Enter fullscreen mode Exit fullscreen mode

Set it to 0 for no cap.

The important part is what does not get bypassed:

  • fact, number, and date checks
  • similarity checks against the source
  • duplicate detection
  • AI quality review
  • the global kill switch

Time sensitivity changes scheduling. It does not lower editorial standards.

Scheduler behaviour

The scheduler used to stop when the ordinary cap was reached. That made the bypass useless: no collection meant no new time-sensitive items to evaluate.

Now the scheduler keeps collecting when the ordinary cap is full. Ordinary items are deferred before the expensive drafting step. Time-sensitive items continue through the pipeline.

The pending queue is also sorted by timeliness, so a sports item behind several ordinary notices is not blocked by them in the same run.

What this changes in practice

  • A sports result can publish after the ordinary quota is full.
  • A weather disruption or transport suspension can publish the same day.
  • A local application deadline can survive the ordinary cap.
  • A generic product review cannot bypass the cap just because it was published recently.
  • A time-sensitive item that fails the fact or quality gates still stays in the draft queue.

The counter is no longer a single yes/no switch. It is a policy boundary with an explicit exception path.

Design notes

A few things I would keep if I rebuilt this:

  • Use rules first. A classifier that only runs after publishing cannot help scheduling.
  • Put the bypass in the quota layer, not the quality layer. Mixing them makes every exception a safety exception.
  • Make the exception quota visible. A hidden unlimited bypass is hard to reason about later.
  • Keep a separate audit trail. Store the score and the reasons on the article record.
  • Expect false positives. Category-aware keyword rules are easier to tune than an opaque model prompt.

The result is not “publish everything.” It is “publish the things whose value depends on being early, without letting everything else skip the queue.”


WFile publishes public-information news in Japanese, Korean, Thai, Vietnamese, Indonesian, and English: wfile.org. The open-data repository is at github.com/adnxx1wsx/wfile-open-data.

Top comments (0)