noot
This commit is contained in:
parent
e8be23774f
commit
5e8a2e0798
14
docker-compose.yaml
Normal file
14
docker-compose.yaml
Normal 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:
|
||||||
@ -1,9 +0,0 @@
|
|||||||
version: '3'
|
|
||||||
services:
|
|
||||||
db:
|
|
||||||
image: postgres
|
|
||||||
restart: always
|
|
||||||
environment:
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
ports:
|
|
||||||
- 54327:5432
|
|
||||||
@ -20,11 +20,11 @@ const playerSchema = playerSchemaFail.or(playerSchemaSuccess)
|
|||||||
const getUUIDForUsername = async (username: string) => {
|
const getUUIDForUsername = async (username: string) => {
|
||||||
const resp = await axios.get(`https://api.mojang.com/users/profiles/minecraft/${username}`, {
|
const resp = await axios.get(`https://api.mojang.com/users/profiles/minecraft/${username}`, {
|
||||||
validateStatus: function (status) {
|
validateStatus: function (status) {
|
||||||
return status < 500;
|
return status < 300 && status >= 200;
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if (resp.headers['content-type'] !== 'application/json') {
|
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})
|
log.info('response data', {data: resp.data})
|
||||||
const parsed = playerSchema.assert(resp.data)
|
const parsed = playerSchema.assert(resp.data)
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import path from 'node:path'
|
|||||||
import { Client, ScheduleNotFoundError, type ScheduleOptions, ScheduleOverlapPolicy } from '@temporalio/client'
|
import { Client, ScheduleNotFoundError, type ScheduleOptions, ScheduleOverlapPolicy } from '@temporalio/client'
|
||||||
import { NativeConnection, Worker, Runtime } from '@temporalio/worker'
|
import { NativeConnection, Worker, Runtime } from '@temporalio/worker'
|
||||||
import { PG } from '#/services/pg'
|
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 * as activities from '../activities'
|
||||||
|
|
||||||
import { config } from '#/config'
|
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) => {
|
const addSchedules = async (c: Client) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user