Skip to content

Commit

Permalink
Refuse to load archived RegionConfig in TopologyService.get (#1315)
Browse files Browse the repository at this point in the history
This shouldn't get called for archived regions, but somehow it is, and it causes
big problems when the region in question is broken.
This will make it bail out rather than try to load an archived region, which
should limit the scope of the problem to whatever old entity is trying to
load it, rather than breaking the whole site.
  • Loading branch information
KlaasH committed Jun 23, 2023
1 parent 8339bb7 commit 1f65eff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- Updated database Terraform module to use the 'max_allocated_storage' param [#1312](https://github.com/PublicMapping/districtbuilder/pull/1312)
- Made TopologyService check 'archived' status and refuse to load archived layers [#1315](https://github.com/PublicMapping/districtbuilder/pull/1315)

### Fixed

Expand Down
4 changes: 4 additions & 0 deletions src/server/src/districts/services/topology.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ export class TopologyService {
if (!this._layers) {
return;
}
if (regionConfig.archived) {
this.logger.error(`Tried to load archived RegionConfig ${regionConfig.id}`);
return undefined;
}
if (!(regionConfig.s3URI in this._layers)) {
// If we encounter a new layer (i.e. one added after the service has started),
// then store the results in the `_layers` object.
Expand Down

0 comments on commit 1f65eff

Please sign in to comment.