mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-26 04:25:15 +01:00
Only count the jobIds from database to prevent workers are set to 1 if there is no workers
This commit is contained in:
parent
c4d0d0101a
commit
e1d22533d1
@ -1190,28 +1190,13 @@ public abstract class JobsDAO {
|
||||
PreparedStatement prest = null;
|
||||
ResultSet res = null;
|
||||
try {
|
||||
prest = conn.prepareStatement("SELECT COUNT(*) FROM `" + getJobsTableName() + "` WHERE `" + JobsTableFields.job + "` = ?;");
|
||||
prest.setString(1, JobName);
|
||||
res = prest.executeQuery();
|
||||
if (res.next()) {
|
||||
count += res.getInt(1);
|
||||
}
|
||||
|
||||
if (count == 0) {
|
||||
close(prest);
|
||||
close(res);
|
||||
|
||||
prest = null;
|
||||
res = null;
|
||||
|
||||
Job job = Jobs.getJob(JobName);
|
||||
if (job != null && job.getId() != 0) {
|
||||
prest = conn.prepareStatement("SELECT COUNT(*) FROM `" + getJobsTableName() + "` WHERE `" + JobsTableFields.jobid + "` = ?;");
|
||||
prest.setInt(1, job.getId());
|
||||
res = prest.executeQuery();
|
||||
if (res.next()) {
|
||||
count += res.getInt(1);
|
||||
}
|
||||
Job job = Jobs.getJob(JobName);
|
||||
if (job != null && job.getId() != 0) {
|
||||
prest = conn.prepareStatement("SELECT COUNT(*) FROM `" + getJobsTableName() + "` WHERE `" + JobsTableFields.jobid + "` = ?;");
|
||||
prest.setInt(1, job.getId());
|
||||
res = prest.executeQuery();
|
||||
if (res.next()) {
|
||||
count += res.getInt(1);
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
|
Loading…
Reference in New Issue
Block a user