-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
termux-job-scheduler: New jobs default to job ID 0 #164
Comments
Then termux would have to store and skip every custom job number a user passes and remove them. Current way allows user to control the behaviour and how it should be. But a note in the help doc that the default is |
How about just taking max(existing job IDs) + 1 as the next job ID? You're guaranteed a unique ID without having to store anything extra, though I don't know the overhead of needing to list existing jobs. The ID it chooses might not be ideal if you've curated your existing IDs, but at that point you should already know about |
A user may themselves pass |
To clarify, are you referring to users who have their own tools (wrapping termux-job-scheduler) to create jobs, and track their own job IDs? If so then yes, if they then created a job outside of their tooling and it claimed the next ID, their tools would need to look for that, but again I would have thought there'd be enough awareness of job IDs at that point that they'd need to give it a non-conflicting one. I suppose an alternative is just taking the first available job ID, and suggest that users managing their own fleet of jobs choose sufficiently high job IDs to avoid conflicts. Making the ID 0 default clearer avoids these problems, but it feels like it's making what I'd expect to be the more general case (just ad-hoc scheduling multiple jobs) a pain: as it stands, I have to check the job list to find the current max ID, and then specify a free ID for each new job. |
Yes. If a job id wasn't passed, and termux chooses its own, it may break cases when chosen id is also selected by wrappers/users. I guess a |
Problem description
When creating a new job, with no ID given it assumes ID 0 and replaces an existing job of that ID.
Steps to reproduce
Expected behavior
I'd expect the default behaviour to choose the next available job number and not replace an existing job.
This reads to me like it will override a job only if you explicitly give it an existing job ID (it doesn't specify a default of 0).
Additional information
The text was updated successfully, but these errors were encountered: