Skip to content

Commit

Permalink
fix retention policy (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-codes authored Dec 28, 2023
2 parents 1918dfc + 3dc4576 commit 778e84e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-request-master-closed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ jobs:
owner: ${{ github.actor }}
token: ${{ secrets.GITHUB_TOKEN }}
package-type: container
package-name: ${{ env.REGISTRY }}/${{ github.repository }}
package-name: playnite-web
ignore-versions: '^([a-z0-9]+-v[0-9]+\.[0-9]+\.[0-9]+)|([a-z0-9]+-PR(?!${{ github.event.pull_request.number }})|([a-z0-9]+-dev))$]'
59 changes: 29 additions & 30 deletions apps/game-db-updater/src/mqttClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,39 @@ import createDebugger from 'debug'
let mqttClient: AsyncMqttClient

type MqttConnectionOptions = {
host?: string
port?: number
username?: string
password?: string
host?: string
port?: number
username?: string
password?: string
}

const getMqttClient = async (
connectionOptions?: MqttConnectionOptions,
connectionOptions?: MqttConnectionOptions,
): Promise<AsyncMqttClient> => {
const debug = createDebugger('game-db-updater/mqttClient')

if (!mqttClient) {
const host =
connectionOptions?.host ?? process.env.MQTT_HOST ?? 'localhost'
const port =
connectionOptions?.port ??
parseInt(process.env.MQTT_PORT ?? '1883', 10)
const username =
connectionOptions?.username ?? process.env.MQTT_USERNAME ?? ''
const password =
connectionOptions?.password ?? process.env.MQTT_PASSWORD ?? ''

debug(
`Existing MQTT client not found; creating one with the following options: host=${host}, port=${port}, username=${username}`,
)
mqttClient = await connectAsync(`tcp://${host}`, {
password,
port,
username,
})
}

debug('Returning MQTT client')
return mqttClient
const debug = createDebugger('game-db-updater/mqttClient')

if (!mqttClient) {
const host = connectionOptions?.host ?? process.env.MQTT_HOST ?? 'localhost'
const port =
connectionOptions?.port ?? parseInt(process.env.MQTT_PORT ?? '1883', 10)
const username =
connectionOptions?.username ?? process.env.MQTT_USERNAME ?? ''
const password =
connectionOptions?.password ?? process.env.MQTT_PASSWORD ?? ''

debug(
`Existing MQTT client not found; creating one with the following options: host=${host}, port=${port}, username=${username}`,
)
mqttClient = await connectAsync(`tcp://${host}`, {
password,
port,
username,
})
}

debug('Returning MQTT client')

return mqttClient
}

export { getMqttClient }

0 comments on commit 778e84e

Please sign in to comment.