Skip to content

[SMC-51] Per problem time limit#58

Merged
Dart147 merged 17 commits into
mainfrom
feat/per-problem-time-limit
Jun 11, 2026
Merged

[SMC-51] Per problem time limit#58
Dart147 merged 17 commits into
mainfrom
feat/per-problem-time-limit

Conversation

@FarmerLiong

Copy link
Copy Markdown
Collaborator

Type of changes

Feature

Purpose

  • Allow admins to set a per-problem execution time limit (ms) when creating or editing a problem, replacing the global 5-second constant used by the
    judge
  • A zero or unset time limit defaults to 5 000 ms, keeping all existing problems unaffected
  • Both judge runners (ProcessRunner and DockerRunner) now enforce the per-problem limit for test-case execution; compile steps still use the global
    constant

Additional Information

  • TimeLimitMs int is added to domain.Problem and threaded through the full stack: repository (existing time_limit_ms DB column), handler (JSON
    decode on create/update, JSON encode on GetByIDAdmin), and both judge runners
  • The executionTimeout(ms int) time.Duration helper in judge.go centralises the fallback logic — returns the global ExecutionTimeout when ms ≤ 0
  • Existing sqlmock tests were updated to include the time_limit_ms column in all SELECT mock patterns; 3 new repository tests and 2 new handler tests
    cover the new behaviour
  • Frontend gains a "Time Limit (ms)" number input (min 100, default 5 000) in both the create form and the edit modal; the local problem-list patch after
    edit also carries the updated value

@FarmerLiong FarmerLiong changed the title Feat/per problem time limit [SMC-51] Per problem time limit Jun 11, 2026
@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown

✅ Snapshot Deployment Ready

Item Value
Status Status
Preview https://pr-58.showmeyourcode.online
Commit 5bc72276bd0641d95ac173fd8f13ce59bf635c59
Triggered by @FarmerLiong

Open Preview

@sonarqubecloud

Copy link
Copy Markdown

@Dart147 Dart147 added the enhancement New feature or request label Jun 11, 2026
@Dart147 Dart147 merged commit 5e6a771 into main Jun 11, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants