mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-27 07:07:31 +00:00
724c88c201
A mechanical prettier --write over server/src, server/tests, server/scripts and shared/src with the workspaces' .prettierrc; nothing but layout and import order changes, and every file keeps the same set of imports. shared is formatted throughout and its format baseline is empty. The server baseline keeps the 35 files that Prettier would grow past their lint:size limit (they need a split first, which is not a formatting change), and the generated entity files stay as their generator writes them.
28 lines
1.0 KiB
TypeScript
28 lines
1.0 KiB
TypeScript
import { startGeoCacheCleanup, stopGeoCacheCleanup } from './nominatim.client';
|
|
import { Injectable, OnModuleInit, OnModuleDestroy } from '@nestjs/common';
|
|
|
|
/**
|
|
* Owns the geo cache's cleanup timer, and nothing else.
|
|
*
|
|
* Deliberately not a facade over `nominatimFetch`. The throttle cursor and the
|
|
* cache have to be module state — the bridges construct their collaborators by
|
|
* hand, outside the container, and a second copy of the cursor is exactly the
|
|
* defect this domain exists to remove. A provider wrapping them would suggest
|
|
* per-instance state that is not there.
|
|
*
|
|
* What the container does add is a lifecycle. Atlas used to start this interval
|
|
* as an import-time side effect, documented as a parity exception; a timer
|
|
* nobody stops is how a test process ends up hanging, and the container has a
|
|
* hook for exactly this.
|
|
*/
|
|
@Injectable()
|
|
export class GeocodingService implements OnModuleInit, OnModuleDestroy {
|
|
onModuleInit(): void {
|
|
startGeoCacheCleanup();
|
|
}
|
|
|
|
onModuleDestroy(): void {
|
|
stopGeoCacheCleanup();
|
|
}
|
|
}
|