Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Remaining delay calculation for background task is calculated from the wrong time. #1706

Copy link
Copy link
@couchcrew-thomas

Description

@couchcrew-thomas
Issue body actions

Version 4.0 Snapshot

When calling a background method delayed with a delay and serial from a method entry with the same serial, the remaining delay of method delayed is calculated wrong after the execution of entry.

@Background(serial = "foo")
protected void entry() {
    long executionTime = System.currentTimeMillis();
    delayed(executionTime);
}

@Background(serial = "foo", id = "delayedTask", delay = 20000L)
protected void delayed(final long execTime) {
    boolean test = System.currentTimeMillis() - execTime >= 20000L;
    Log.d("bug", String.valueOf(test));
}

The test returns false.

This is caused by wrong calculation in BackgroundExecutor Line 429. It calculates the delay of the next task from the targetTimeMillis of the currently finishing task when it should use targetTimeMillis of the next task.

Note
I did not test the behaviour of the @UiThread executor. It could be possible the issue occurs there as well.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.