UBERF-8469: Fix exit from github service (#6921)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev
2024-10-15 10:04:39 +05:00
committed by GitHub
parent 81e02eb8ca
commit a714be51e9
13 changed files with 89 additions and 9 deletions
+7 -2
View File
@@ -18,7 +18,7 @@ import { decodeToken } from '@hcengineering/server-token'
/**
* @public
*/
export async function start (ctx: MeasureContext, brandingMap: BrandingMap): Promise<void> {
export async function start (ctx: MeasureContext, brandingMap: BrandingMap): Promise<() => Promise<void>> {
// Create an authenticated Octokit client authenticated as a GitHub App
ctx.info('Running Huly Github integration', { appId: config.AppID, clientID: config.ClientID })
@@ -184,8 +184,13 @@ export async function start (ctx: MeasureContext, brandingMap: BrandingMap): Pro
}
})
app.listen(port, () => {
const server = app.listen(port, () => {
ctx.info(`Server is listening for events at: ${localWebhookUrl}`)
ctx.info('Press Ctrl + C to quit.')
})
return async () => {
await worker.close()
server.close()
}
}