Я узнал, что означает -1 в schedule_requested_at.
Из WorkSpec.java (рабочая среда: 1.0.0-alpha11) :
/**
* This field tells us if this {@link WorkSpec} instance, is actually currently scheduled and
* being counted against the {@code SCHEDULER_LIMIT}. This bit is reset for PeriodicWorkRequests
* in API < 23, because AlarmManager does not know of PeriodicWorkRequests. So for the next
* request to be rescheduled this field has to be reset to {@code SCHEDULE_NOT_REQUESTED_AT}.
* For the JobScheduler implementation, we don't reset this field because JobScheduler natively
* supports PeriodicWorkRequests.
*/
@ColumnInfo(name = "schedule_requested_at")
public long scheduleRequestedAt = SCHEDULE_NOT_REQUESTED_YET;
Если значение равно -1, работа была вставлена встол, но это еще не было запланировано.
В моем случае было слишком много экземпляров Work, чтобы запланировать что-то новое, после этого запроса из WorkSpecDao.java :
/**
* @return The List of {@link WorkSpec}s that are eligible to be scheduled.
*/
@Query("SELECT * FROM workspec WHERE "
+ "state=" + WorkTypeConverters.StateIds.ENQUEUED
// We only want WorkSpecs which have not been previously scheduled.
+ " AND schedule_requested_at=" + WorkSpec.SCHEDULE_NOT_REQUESTED_YET
+ " LIMIT "
+ "(SELECT MAX(:schedulerLimit" + "-COUNT(*), 0) FROM workspec WHERE"
+ " schedule_requested_at<>" + WorkSpec.SCHEDULE_NOT_REQUESTED_YET
+ " AND state NOT IN " + COMPLETED_STATES
+ ")"
)
List<WorkSpec> getEligibleWorkForScheduling(int schedulerLimit);