Changeset View
Changeset View
Standalone View
Standalone View
swh/scheduler/backend.py
Show First 20 Lines • Show All 423 Lines • ▼ Show 20 Lines | ) -> List[ListedOrigin]: | ||||
) | ) | ||||
# order by decreasing visit lag | # order by decreasing visit lag | ||||
order_by = ( | order_by = ( | ||||
"listed_origins.last_update - origin_visit_stats.last_successful DESC" | "listed_origins.last_update - origin_visit_stats.last_successful DESC" | ||||
) | ) | ||||
elif policy == "origins_without_last_update": | elif policy == "origins_without_last_update": | ||||
where_clauses.append("last_update IS NULL") | where_clauses.append("last_update IS NULL") | ||||
order_by = "origin_visit_stats.next_visit_queue_position nulls first" | order_by = ", ".join( | ||||
[ | |||||
# By default, sort using the queue position. If the queue | |||||
# position is null, then the origin has never been visited, | |||||
# which we want to handle first | |||||
"origin_visit_stats.next_visit_queue_position nulls first", | |||||
# Schedule unknown origins in the order we've seen them | |||||
"listed_origins.first_seen", | |||||
] | |||||
) | |||||
# fmt: off | # fmt: off | ||||
# This policy requires updating the global queue position for this | # This policy requires updating the global queue position for this | ||||
# visit type | # visit type | ||||
common_table_expressions.append(("update_queue_position", """ | common_table_expressions.append(("update_queue_position", """ | ||||
INSERT INTO | INSERT INTO | ||||
visit_scheduler_queue_position(visit_type, position) | visit_scheduler_queue_position(visit_type, position) | ||||
▲ Show 20 Lines • Show All 650 Lines • Show Last 20 Lines |