Skip to content

fix(backend): return Unit from async refreshCountryUsage - #616

Merged
JuliusHenke merged 1 commit into
masterfrom
fix/backend-async-country-usage
Oct 12, 2026
Merged

JuliusHenke merged 1 commit into
masterfrom
fix/backend-async-country-usage

Conversation

@JuliusHenke

Copy link
Copy Markdown
Member

Problem

The edge image from master logs this error each time the country usage refresh runs:

java.lang.IllegalArgumentException: Invalid return type for async method (only Future and void supported): int
    at org.tormap.service.SchedulingService$$SpringCGLIB$$0.refreshCountryUsage(<generated>)

SchedulingService is annotated @Async at class level. refreshCountryUsage() (added in #606) had an expression body, so it returned the Int from CountryUsageService.refresh(). Spring rejects that before the task runs, so country usage was never refreshed.

Fix

  • Use a block body so the method returns Unit/void. No other scheduled method was affected.
  • Add SchedulingServiceTest, which uses reflection to check that every @Scheduled method returns void or Future. I confirmed it fails against the old code.

🤖 Generated with Claude Code

SchedulingService is annotated with @async, which only supports void
or Future return types. The expression body of refreshCountryUsage
returned the Int from CountryUsageService.refresh(), so every run failed
with "Invalid return type for async method".

Add a test that checks all scheduled methods return void or Future.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JuliusHenke JuliusHenke added bug Something isn't working backend labels Oct 12, 2026
@JuliusHenke
JuliusHenke marked this pull request as ready for review October 12, 2026 22:11
@JuliusHenke
JuliusHenke merged commit 8740274 into master Oct 12, 2026
10 of 11 checks passed
@JuliusHenke
JuliusHenke deleted the fix/backend-async-country-usage branch October 12, 2026 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant