Skip to content
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.

Check for running serial / id in BackgroundExecutor #979

Description

@JoanZapata

Hi,

As explained here, I use @Background a lot in my app. I use serial and id a lot too.

It would be very nice to be able to check if a task has already been submitted with a given id or serial. That would allow to avoid stacking a new task if one is already pending / running. Methods could be:

  • BackgroundExecutor.hasSerialPending(serial)
  • BackgroundExecutor.hasIdPending(serial)
  • BackgroundExecutor.hasSerialRunning(serial)
  • BackgroundExecutor.hasIdRunning(serial)

What do you think?

Activity

  1. Artyomcool commented on Apr 29, 2014

    @Artyomcool

    Android way to achieve this - just to cancel tasks by id without allowing
    inturruption. And then - just add another one.

  2. JoanZapata commented on Apr 29, 2014

    @JoanZapata
    ContributorAuthor

    Yeah that's what I used in some places, but here's a few limitations with this method :

    • If the existing task with this id has the same serial than other ones, the order in which they'll get executed will change. I don't want that.
    • If the existing task with this id is currently running, there's a few situations in which I want to let it finish normally and not add another one with the same id.

    In these cases I'd like to be able to "skip" the call I was about to do, and let the existing tasks as they are.

  3. DayS commented on May 4, 2014

    @DayS
    Contributor

    It doesn't cost much and I think it should be helpful to many. I'm ok with this feature

  4. added this to the 3.1 milestone on May 4, 2014
  5. modified the milestones: 3.1, 3.2 on Sep 20, 2014
  6. removed this from the 3.2 milestone on Nov 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions