noot
Some checks failed
commit-tag / commit-tag-image (map[context:./migrations file:./migrations/Dockerfile name:migrations]) (push) Successful in 17s
commit-tag / commit-tag-image (map[context:./ts file:./ts/Dockerfile name:ts]) (push) Failing after 57s

This commit is contained in:
a 2025-06-30 22:02:48 -05:00
parent e8be23774f
commit 5e8a2e0798
No known key found for this signature in database
GPG Key ID: 2F22877AA4DFDADB
4 changed files with 35 additions and 12 deletions

14
docker-compose.yaml Normal file
View File

@ -0,0 +1,14 @@
version: '3.8'
services:
db:
image: postgres:17
environment:
POSTGRES_PASSWORD: postgres
volumes:
- /data/postgres/wynn:/var/lib/postgresql/data
ports:
- 54327:5432
volumes:
pgdata:

View File

@ -1,9 +0,0 @@
version: '3'
services:
db:
image: postgres
restart: always
environment:
POSTGRES_PASSWORD: postgres
ports:
- 54327:5432

View File

@ -20,11 +20,11 @@ const playerSchema = playerSchemaFail.or(playerSchemaSuccess)
const getUUIDForUsername = async (username: string) => {
const resp = await axios.get(`https://api.mojang.com/users/profiles/minecraft/${username}`, {
validateStatus: function (status) {
return status < 500;
return status < 300 && status >= 200;
},
})
if (resp.headers['content-type'] !== 'application/json') {
throw new Error('invalid content type')
throw new Error(`invalid content type: ${resp.headers['content-type']}`)
}
log.info('response data', {data: resp.data})
const parsed = playerSchema.assert(resp.data)

View File

@ -8,7 +8,7 @@ import path from 'node:path'
import { Client, ScheduleNotFoundError, type ScheduleOptions, ScheduleOverlapPolicy } from '@temporalio/client'
import { NativeConnection, Worker, Runtime } from '@temporalio/worker'
import { PG } from '#/services/pg'
import { workflowSyncAllGuilds, workflowSyncGuildLeaderboardInfo, workflowSyncGuilds, workflowSyncOnline } from '#/workflows'
import { workflowSyncAllGuilds, workflowSyncGuildLeaderboardInfo, workflowSyncGuilds, workflowSyncOnline, workflowSyncItemDatabase } from '#/workflows'
import * as activities from '../activities'
import { config } from '#/config'
@ -87,6 +87,24 @@ const schedules: ScheduleOptions[] = [
],
},
},
{
scheduleId: 'update-wynn-items',
action: {
type: 'startWorkflow',
workflowType: workflowSyncItemDatabase,
taskQueue: 'wynn-worker-ts',
},
policies: {
overlap: ScheduleOverlapPolicy.SKIP,
},
spec: {
intervals: [
{
every: '4 hours',
},
],
},
},
]
const addSchedules = async (c: Client) => {