clean up old items that didn't match Use cross reference list for constant time operation here
(self)
| 2127 | # Would be curious to have this as like a "log level" or something |
| 2128 | |
| 2129 | def left_over_instance_deletion(self): |
| 2130 | """ |
| 2131 | clean up old items that didn't match |
| 2132 | Use cross reference list for constant time operation here |
| 2133 | |
| 2134 | """ |
| 2135 | if self.instance_list_existing is None: |
| 2136 | return |
| 2137 | |
| 2138 | for remaining_hash in self.hash_list: |
| 2139 | index = self.hash_old_cross_reference[remaining_hash] |
| 2140 | instance = self.instance_list_existing[index] |
| 2141 | prior_hash = instance.hash |
| 2142 | |
| 2143 | instance.soft_delete = True |
| 2144 | if instance.deletion_type is None: |
| 2145 | instance.deletion_type = 'system_deletion' |
| 2146 | instance.next_id = self.previous_next_instance_map.get(instance.id) |
| 2147 | # We need to rehash the instance in order to have the soft_delete and next_id be part of the hash. |
| 2148 | instance.hash_instance() |
| 2149 | |
| 2150 | # logger.info(instance.hash == prior_hash) |
| 2151 | |
| 2152 | if instance.hash != prior_hash: |
| 2153 | self.declare_newly_deleted_instance(instance = instance) |
| 2154 | |
| 2155 | def declare_newly_deleted_instance( |
| 2156 | self, |
no test coverage detected