Handle closing of the program in the same slot as deployment (#33025)

This commit is contained in:
Pankaj Garg 2023-08-28 09:05:49 -07:00 committed by GitHub
parent f4dcb20d2e
commit e036a0375d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -467,9 +467,11 @@ impl LoadedPrograms {
Ordering::Relaxed,
);
second_level.remove(entry_index);
} else if existing.is_tombstone() && !entry.is_tombstone() {
// The old entry is tombstone and the new one is not. Let's give the new entry
// a chance.
} else if existing.is_tombstone() != entry.is_tombstone() {
// Either the old entry is tombstone and the new one is not.
// (Let's give the new entry a chance).
// Or, the old entry is not a tombstone and the new one is a tombstone.
// (Remove the old entry, as the tombstone makes it obsolete).
second_level.remove(entry_index);
} else {
self.stats.replacements.fetch_add(1, Ordering::Relaxed);