Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d866177
feat: upgrade to pgboss 12
NivGreenstein Feb 4, 2026
611bff7
fix: remove uuid. changed props name
NivGreenstein Feb 4, 2026
739feec
fix: update pgboss type import
NivGreenstein Feb 4, 2026
58fbc10
fix: changed getQueueSize to getQueueStats
NivGreenstein Feb 4, 2026
2100189
fix: update pgboss code
NivGreenstein Feb 4, 2026
8b84211
feat: added queues name factory
NivGreenstein Feb 5, 2026
4b29b23
feat: added postInjectionHook to stop queue on cleanup
NivGreenstein Feb 5, 2026
af8249a
feat: upgrade schema
NivGreenstein Feb 5, 2026
d1e1d41
feat: enable migrations by default. changed retention hours to seconds
NivGreenstein Feb 5, 2026
c14f083
refactor: implemented QUEUES_NAME and startQueue that created pgboss …
NivGreenstein Feb 5, 2026
13cebda
refactor: implemented QueuesName
NivGreenstein Feb 5, 2026
1db8db7
ci: update helm
NivGreenstein Feb 5, 2026
06dcef9
ci: update postgresql to 15
NivGreenstein Feb 5, 2026
6936a39
refactor: renamed QueuesName to QueueName
NivGreenstein Feb 5, 2026
c9cff87
fix: fix jest config
NivGreenstein Feb 5, 2026
e6b5dab
feat: added pgboss mock
NivGreenstein Feb 5, 2026
dcfcf43
fix: fix test breaking changes
NivGreenstein Feb 5, 2026
baf255f
docs: update docs
NivGreenstein Feb 5, 2026
644ed39
ci: changed code owners
NivGreenstein Feb 5, 2026
71452b2
fix: inject pgboss mock in docs tests
NivGreenstein Feb 5, 2026
a1c26ef
fix: added create queues when pgboss start
NivGreenstein Feb 5, 2026
90b7420
fix: added init config in offline mode
NivGreenstein Feb 5, 2026
02279bf
chore: added queueNames constant
NivGreenstein Feb 5, 2026
96ce1af
fix: update tests
NivGreenstein Feb 5, 2026
12e6779
fix: removed create queue from pgbossjobqueue
NivGreenstein Feb 5, 2026
95b755d
fix: fix test to work on new pgboss
NivGreenstein Feb 5, 2026
7d58320
fix: added queue to queueNames
NivGreenstein Feb 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @netanelC @CptSchnitz @shimoncohen
* @MapColonies/vector-team
2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:

services:
postgres:
image: postgres:14
image: postgres:15
env:
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }}
POSTGRES_USER: ${{ env.DB_USERNAME }}
Expand Down
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,16 @@ each item on this queue is a metatile in the size of metatile property located i
- `QUEUE_JOBS_RETRY_BACKOFF` - Default: true. Enables exponential backoff retries based on retryDelay instead of a fixed delay. Sets initial retryDelay to 1 if not set.
- `QUEUE_JOBS_RETRY_LIMIT` - Default: 3. Max number of retries of failed jobs.
- `QUEUE_JOBS_RETRY_DELAY_SECONDS` - Default: 60. Delay between retries of failed jobs, in seconds.
- `QUEUE_JOBS_RETENTION_HOURS` - Default: 87660. How many hours a job may be in created or retry state before it's archived. Must be >=1
- `QUEUE_JOBS_RETENTION_SECONDS` - Default: 315576000. How many seconds a job may be in created or retry state before it's archived. Must be >=1
- `DB_CREATE_SCHEMA` - Default: false. enable pg-boss schema creation at startup
- `DB_RUN_MIGRATE` - Default: false. enable pg-boss schema migrations at startup
- `APP_CONSUME_CONDITION_ENABLED` - Pre-request consumption flag for conditions validation, current condition is tiles queue size (see `APP_CONSUME_CONDITION_TILES_QUEUE_SIZE_LIMIT`)
- `APP_CONSUME_CONDITION_TILES_QUEUE_SIZE_LIMIT` - The max number of tiles in the tiles queue allowed before the request consumption
- `APP_CONSUME_CONDITION_CHECK_INTERVAL_SEC` - upon invalid match to the consume condition, the duration in seconds to wait until the next consume condition validation
- `APP_CONSUME_CONDITION_CHECK_INTERVAL_SEC` - upon invalid match to the consume condition, the duration in seconds to wait until the next consume condition validation

## pg-boss migrations
pg-boss v12 requires its database schema to be created and migrated before starting the service. Run migrations with the pg-boss CLI using your database connection (or `PGBOSS_*` environment variables):

```bash
npx pg-boss migrate --connection-string postgres://user:pass@host:5432/database --schema pgboss
```
4 changes: 3 additions & 1 deletion config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,16 @@
"retryBackoff": true,
"retryLimit": 3,
"retryDelaySeconds": 60,
"retentionHours": 87660
"retentionSeconds": 315576000
},
"db": {
"host": "localhost",
"port": 5432,
"username": "postgres",
"password": "postgres",
"schema": "pgboss",
"createSchema": true,
"migrate": true,
"ssl": {
"enabled": false,
"ca": "",
Expand Down
4 changes: 3 additions & 1 deletion helm/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ data:
DB_HOST: {{ .host }}
DB_NAME: {{ .database }}
DB_SCHEMA: {{ .schema }}
DB_CREATE_SCHEMA: {{ .createSchema | quote }}
DB_RUN_MIGRATE: {{ .migrate | quote }}
DB_PORT: {{ .port | quote }}
{{- end -}}
{{- with .Values.queueConfig }}
QUEUE_JOBS_EXPIRE_IN_SECONDS: {{ .expireInSeconds | quote }}
QUEUE_JOBS_RETRY_BACKOFF: {{ .retryBackoff | quote }}
QUEUE_JOBS_RETRY_LIMIT: {{ .retryLimit | quote }}
QUEUE_JOBS_RETRY_DELAY_SECONDS: {{ .retryDelaySeconds | quote }}
QUEUE_JOBS_RETENTION_HOURS: {{ .retentionHours | quote }}
QUEUE_JOBS_RETENTION_SECONDS: {{ .retentionSeconds | quote }}
{{- end -}}
FORCE_API_TILES: {{ .Values.env.force.api | quote }}
FORCE_EXPIRED_TILES: {{ .Values.env.force.expiredTiles | quote }}
Expand Down
4 changes: 3 additions & 1 deletion helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,16 @@ queueConfig:
retryBackoff: true
retryLimit: 3
retryDelaySeconds: 60
retentionHours: 87660
retentionSeconds: 315576000

dbConfig:
host: localhost
username: postgres
password: postgres
database: metatile-queue-populator
schema: pgboss
createSchema: true
migrate: true
port: 5432
sslAuth:
enabled: false
Expand Down
161 changes: 75 additions & 86 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@map-colonies/js-logger": "^1.0.1",
"@map-colonies/openapi-express-viewer": "^3.0.0",
"@map-colonies/read-pkg": "0.0.1",
"@map-colonies/schemas": "^1.17.0",
"@map-colonies/schemas": "https://ghatmpstorage.blob.core.windows.net/npm-packages/schemas-36806c74374e95e9771f7673691d2fd33cb2337e.tgz",
"@map-colonies/telemetry": "^10.0.1",
"@map-colonies/tile-calc": "0.1.3",
"@map-colonies/tsconfig": "^1.0.1",
Expand All @@ -55,7 +55,7 @@
"express": "^4.19.2",
"express-openapi-validator": "^5.0.4",
"http-status-codes": "^2.2.0",
"pg-boss": "^7.1.0",
"pg-boss": "^12.8.0",
"prom-client": "^15.1.2",
"reflect-metadata": "^0.1.13",
"snake-case": "^3.0.4",
Expand Down
6 changes: 3 additions & 3 deletions src/common/config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { type ConfigInstance, config } from '@map-colonies/config';
import { vectorMetatileQueuePopulatorFullV1, type vectorMetatileQueuePopulatorFullV1Type } from '@map-colonies/schemas';
import { vectorMetatileQueuePopulatorFullV2, type vectorMetatileQueuePopulatorFullV2Type } from '@map-colonies/schemas';

// Choose here the type of the config instance and import this type from the entire application
type ConfigType = ConfigInstance<vectorMetatileQueuePopulatorFullV1Type>;
type ConfigType = ConfigInstance<vectorMetatileQueuePopulatorFullV2Type>;

let configInstance: ConfigType | undefined;

Expand All @@ -13,7 +13,7 @@ let configInstance: ConfigType | undefined;
*/
async function initConfig(offlineMode?: boolean): Promise<void> {
configInstance = await config({
schema: vectorMetatileQueuePopulatorFullV1,
schema: vectorMetatileQueuePopulatorFullV2,
offlineMode,
});
}
Expand Down
1 change: 1 addition & 0 deletions src/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ export const ON_SIGNAL = Symbol('onSignal');

export const CONSUME_AND_POPULATE_FACTORY = Symbol('consumeAndPopulateFactory');
export const JOB_QUEUE_PROVIDER = Symbol('JobQueueProvider');
export const QUEUE_NAMES = Symbol('QueueNames');

export const MILLISECONDS_IN_SECOND = 1000;
Loading
Loading