Changeset - r25917:f2cd870a61bf
[Not reviewed]
master
0 2 0
Nicolas Chappe - 3 years ago 2021-08-18 15:06:22
74881848+nchappe@users.noreply.github.com
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.
2 files changed with 8 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/linkgraph/linkgraph.h
Show inline comments
 
@@ -447,6 +447,9 @@ public:
 
	/** Minimum effective distance for timeout calculation. */
 
	static const uint MIN_TIMEOUT_DISTANCE = 32;
 

	
 
	/** Number of days before deleting links served only by vehicles stopped in depot. */
 
	static const uint STALE_LINK_DEPOT_TIMEOUT = 1024;
 

	
 
	/** Minimum number of days between subsequent compressions of a LG. */
 
	static const uint COMPRESSION_INTERVAL = 256;
 

	
src/station_cmd.cpp
Show inline comments
 
@@ -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;
0 comments (0 inline, 0 general)