Scrivio Interview library
LeadershipPrincipal7 min read · updated 12 November 2026

A missed or duplicated scheduled job caused a costly incident at your company: interest was calculated twice for some accounts. As the senior technical leader, how do you address the systemic risk rather than this single bug?

The single bug is the trigger, but the systemic risk is that our financial operations rely on schedulers never misfiring. I would inventory every scheduled financial operation and require idempotency at the data level, such as a unique constraint per account and period, add reconciliation checks after every critical job, choose a scheduling standard with audit history for regulated jobs, and make these rules part of architecture review and the risk register. Then I would fund the remediation explicitly and track it to completion.

Why this question is asked

Interest posted twice is the kind of incident that reaches executives, regulators and customers. The tempting response is to fix the scheduler configuration that caused it and move on, but the same design almost certainly exists in other jobs, and the next trigger problem will find them. Interviewers ask this leadership question to see whether a senior leader can move from a bug to a class of risk, and back it with resources and follow-through. In this answer, we will stabilise the incident, understand why the design was fragile, then go through each systemic measure: finding all affected jobs, idempotency in the data, reconciliation, a scheduling standard, governance, and funding with tracking.

1First, Stabilise and Learn

Before any systemic work, the immediate incident needs to be closed properly. The affected accounts are identified, the duplicate postings are reversed with clear customer communication, and finance, compliance and customer support are told what happened and when it is fixed. Then a blameless post-incident review establishes the timeline: what triggered the second run, why nothing prevented it from posting, and why we found out from customers or finance rather than from our own checks.

The review usually shows that the trigger, a lock that expired or a job that ran on two nodes after a deployment, was only the last link. The real gap was that nothing in the data or the process could tell that interest for that account and month had already been posted. That is what makes this a systemic risk rather than a single bug.

2Find Every Scheduled Financial Operation

We cannot fix a class of risk without knowing its size. The first systemic step is an inventory of every scheduled job that creates or changes money or regulated data: interest accrual, fees, statements, settlements, payouts, regulatory reports. For each one we record the owner, the scheduler it uses, the business period it works on, and whether it is idempotent today.

This takes engineering help, because jobs hide in many places: @Scheduled methods, Quartz triggers, Kubernetes CronJobs, database jobs, scripts on a VM. Pulling the list from code search, scheduler tables and the cluster, then confirming it with each team, usually reveals jobs nobody in leadership knew about. It also gives us the denominator for tracking progress.

3Require Idempotency in the Data

The core rule is that a financial operation for a given account and period can only be recorded once, and that the database, not the scheduler, enforces it. For interest, that means the posting table carries the business period and has a unique constraint on account and period. A second run then fails or does nothing for every account that already has its posting, whatever caused the second run.

SQL
CREATE TABLE interest_posting (
account_id bigint NOT NULL,
period date NOT NULL, -- first day of the month the interest is for
amount numeric(19,4) NOT NULL,
run_id uuid NOT NULL,
posted_at timestamptz NOT NULL DEFAULT now(),
CONSTRAINT one_posting_per_period UNIQUE (account_id, period)
);
INSERT INTO interest_posting (account_id, period, amount, run_id)
VALUES (:account, DATE '2026-10-01', :amount, :run)
ON CONFLICT ON CONSTRAINT one_posting_per_period DO NOTHING;
-- first run: 1 row inserted, ledger entry written in the same transaction
-- second run: 0 rows inserted, the job skips the ledger entry for this account

Notice the key is the business period, not the run time. A job that runs late, twice or after a restart still targets October, so the constraint catches every duplicate. Writing the ledger entry in the same transaction as the posting row means the money moves only when the posting is new. This rule is cheap for new jobs and a defined piece of work for existing ones, which is why the inventory matters.

4Add Reconciliation After Critical Jobs

Idempotency stops duplicates, but it does not catch a job that ran zero times, skipped accounts, or calculated the wrong amount. So every critical job gets a reconciliation check that runs after it and compares outcomes with expectations: the number of postings for the period equals the number of eligible accounts, no account has more than one posting, and the total matches an independent calculation within a tolerance.

A failed reconciliation pages the owning team and blocks downstream steps, such as statements, until it passes. Reconciliation is what turns 'customers told us' into 'we found it at 02:15 and fixed it before anyone saw it'. It is also strong evidence for auditors that controls exist and work.

Step throughEvery critical financial job, after the change
  1. Trigger firesfrom the scheduling standard, with a run id
  2. Job posts per account and periodunique constraint rejects duplicates
  3. Reconciliation runscounts, duplicates, totals
  4. Reconciliation passes?
    Yesrelease downstream steps, record in audit historyNopage the owner, hold statements
  5. Run recordedwho, when, which period, result

5 steps in order. Play them, or step through them one at a time.

5A Scheduling Standard With Audit History

Regulated jobs need more than a lock around @Scheduled. The standard should require a scheduler that records every run, its trigger, its business period, its outcome and who changed its schedule, and that alerts on missed runs. That can be a central scheduler, clustered Quartz with run history added, or a batch platform with its own job repository, as long as the evidence exists and is retained.

The decision should be made once by the architecture group, with the main constraints written down, so teams do not each pick a tool. The standard applies to the regulated class only; housekeeping jobs can stay simple.

6Governance, Funding and Tracking

Rules that are not checked fade. I would add three questions to architecture review for any scheduled job: is it in the inventory, is it idempotent by business key and period, and does it have reconciliation if it is financial. The risk itself goes into the operational risk register with an owner and a target date, which gives it visibility at the level where priorities are set.

Most importantly, the work must be funded. Asking teams to fix forty jobs 'in their spare time' guarantees that it stalls after the first five. I would agree an explicit allocation with product leaders, for example 15 percent of each affected team's capacity for two quarters, track progress against the inventory in a monthly review, and report the number of compliant critical jobs until it reaches 100 percent. Closing the loop matters: a fix that is 80 percent done leaves 20 percent of the risk.

7Follow-up questions

Why is idempotency in the data better than a better lock?

Because a lock only reduces the chance of a second run, while a unique constraint makes a second posting impossible, whatever the cause: a lock failure, a manual rerun, a retry after a crash or a bug in a future scheduler. Locks are still useful to avoid wasted work, but the guarantee belongs in the data.

How do you prioritise forty non-compliant jobs?

By impact and likelihood. Jobs that move the most money or affect customers directly, and that run on the weakest triggers, such as plain @Scheduled on several replicas, go first. Read-only reports and internal jobs come later.

What would you tell the executive team?

What happened and the customer impact, that it is fixed and the money corrected, that the same weakness exists in a known number of other jobs, the plan and cost to remove it with a date, and how we will detect such problems ourselves from now on. Executives need the size of the risk and the commitment, not the details of the lock.

8Conclusion

In this answer, we moved from a single double-posting bug to the systemic risk behind it: financial jobs that trusted their scheduler. After closing the incident, we inventoried every scheduled financial operation, required idempotency in the data with a unique key per account and period, added reconciliation after critical jobs, chose a scheduling standard with audit history for regulated work, and put the rules into architecture review and the risk register. Finally, we funded the remediation explicitly and tracked it until every critical job was compliant.

What to say in the interviewAbout 80 seconds aloud

Open with

First I'd make sure the incident itself is closed: duplicates reversed, customers told, finance and compliance informed, and a blameless review. That review will almost certainly show the scheduler was only the trigger; the real gap is that nothing in the data knew interest for that account and month was already posted.

Then, if they want more

So I'd treat it as a class of risk. Step one is an inventory of every scheduled job that moves money or touches regulated data, with owner, scheduler and whether it's idempotent.

Step two is a rule: financial operations are idempotent at the data level, for interest a unique constraint on account and period, so any second run, whatever the cause, inserts nothing. Step three is reconciliation after every critical job: count of postings against eligible accounts, no duplicates, totals checked, and a failure pages the owner and holds downstream steps.

Step four is a scheduling standard for regulated jobs with run history and missed-run alerts. Then governance: these checks become questions in architecture review and the risk goes into the risk register with an owner. And I'd fund it explicitly, a share of team capacity for a couple of quarters, tracked monthly against the inventory until all critical jobs comply.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
Spring Batch reference
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "A missed or duplicated scheduled job caused a costly incident at your company: interest...": https://scrivio-interview-library.netlify.app/spring-boot/scheduling/30e14d9b4c/