add where clause for marking all jobs pending to reduce the time for writing to db

This commit is contained in:
Ryan Zhao 2023-05-01 17:01:57 +10:00
parent bd4f451513
commit 2630c97a4e

View File

@ -138,7 +138,10 @@ public class JobDatabase extends Database {
ContentValues contentValues = new ContentValues();
contentValues.put(Jobs.IS_RUNNING, 0);
databaseHelper.getWritableDatabase().update(Jobs.TABLE_NAME, contentValues, null, null);
String query = Jobs.IS_RUNNING + " = ?";
String[] args = new String[] { "1" };
databaseHelper.getWritableDatabase().update(Jobs.TABLE_NAME, contentValues, query, args);
}
public synchronized void deleteJobs(@NonNull List<String> jobIds) {