mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 22:13:25 +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,20 +1190,6 @@ 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 + "` = ?;");
|
||||
@ -1213,7 +1199,6 @@ public abstract class JobsDAO {
|
||||
count += res.getInt(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
|
Loading…
Reference in New Issue
Block a user