unprocessedRequests method

Future<List<Map<String, dynamic>>> unprocessedRequests({
  1. bool onlyLocked = false,
})

Returns row data for all unprocessed job in database. Accessing this list can be useful determining queue length.

When onlyLocked is true, only jobs that are not actively being processed are returned. Accessing this sublist can be useful for deleting a job blocking the queue. Defaults false.

Implementation

Future<List<Map<String, dynamic>>> unprocessedRequests({bool onlyLocked = false}) async {
  final db = await getDb();

  if (onlyLocked) {
    return await db.query(
      tableName,
      distinct: true,
      orderBy: orderByStatement,
      where: '$lockedColumn = ?',
      whereArgs: [1],
    );
  }

  return await db.query(
    tableName,
    distinct: true,
    orderBy: orderByStatement,
  );
}