Change: [Linkgraph] Delete links only served by vehicles stopped in depot
A stale link is not deleted if the link refresher finds a vehicle that still serves it. This commit excludes vehicles stopped in depot for a very long time from the link refresher, so that their stale links can be deleted.
This commit is contained in:

committed by
Michael Lutz

parent
dd3acccb1b
commit
b83820e723
@@ -3688,8 +3688,11 @@ void DeleteStaleLinks(Station *from)
|
||||
auto iter = vehicles.begin();
|
||||
while (iter != vehicles.end()) {
|
||||
Vehicle *v = *iter;
|
||||
|
||||
LinkRefresher::Run(v, false); // Don't allow merging. Otherwise lg might get deleted.
|
||||
/* Do not refresh links of vehicles that have been stopped in depot for a long time. */
|
||||
if (!v->IsStoppedInDepot() || static_cast<uint>(_date - v->date_of_last_service) <=
|
||||
LinkGraph::STALE_LINK_DEPOT_TIMEOUT) {
|
||||
LinkRefresher::Run(v, false); // Don't allow merging. Otherwise lg might get deleted.
|
||||
}
|
||||
if (edge.LastUpdate() == _date) {
|
||||
updated = true;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user