Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9090945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:29:37+00:00 2026-06-16T22:29:37+00:00

I have simple scheduler for repeating task every 1 second: Cancellable task = Akka.system().scheduler().schedule(

  • 0

I have simple scheduler for repeating task every 1 second:

Cancellable task = Akka.system().scheduler().schedule(
        Duration.create(0, TimeUnit.MILLISECONDS),
        Duration.create(1, TimeUnit.SECONDS),
        actor, new TickMsg("Tick", 0, 120)
);

Unfortunately every pass is late for the ticker-duration so finally actor receives TickMsg exactly 100 ms later – ok, that’s described in the doc and it’s clear to me:

It does not execute tasks at the exact time, but on every tick, it will run everything that is overdue.

What I can’t understand is why every pass is late, which de facto means that every pass instead 1000ms needs 1100ms. In result after 10 passes we have 1 second of delay, after 1 minute it’s 6 seconds, after 1 hour it’s 6 minutes etc…

Some solution is setting repeat duration little bit shorter, so it’s not late at required tick, for an example that works and then scheduler repeats tasks as required:

Cancellable task = Akka.system().scheduler().schedule(
        Duration.create(0, TimeUnit.MILLISECONDS),
        Duration.create((1000 - tickerDuration/2), TimeUnit.MILLISECONDS),
        actor, new TickMsg("Tick", 0, 120)
);

Unfortunately this way is little bit uncomfortable and easy to forget, is there any other way to repeat tasks every x seconds (or other TimeUnit) without converting it to milliseconds and shortening?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T22:29:38+00:00Added an answer on June 16, 2026 at 10:29 pm

    This is fixed in version 2.1 of Akka.

    The reason is quite simple: the HashedWheelTimer does not know about repeated tasks, so the task needs to reschedule itself, but since this happens by definition after the tick it will always be late and fall into the next bucket. The fix was to include a drift correction, see here for the details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple console application which runs daily (called by windows task scheduler)
I have a simple Azure Worker role running that performs a task every day
I have simple table in Sybase -- Creating table 'SimpleText' CREATE TABLE [dbo].[SimpleText] (
I have simple mailer which sends user weekly digest and rake task which sends
I have a very simple method scheduled to run every 10 seconds like this:
I have simple class with width and height member fields which define number of
I have simple php validation form that is halfway working. If you leave the
I have simple JavaScript snippet: var obrazek = [{nazwa: "Sniadanie", wiek: 100, autor: "Alicja"},{nazwa:
I have simple script with EventMachine, Fibers and faye require faye require em-synchrony require
I have simple database - one table with 6 collumns. 3 of them i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.