1 parent
d85e2498fd
commit
3a7b68430c
2 files changed
+11
-1
No files matched your search
@@ -23,6 +23,7 @@ import {
|
||||
EnvironmentQuery,
|
||||
ServerStatusResponse,
|
||||
StopRequest,
|
||||
StopResponse,
|
||||
} from '@waha/structures/server.dto';
|
||||
import { VERSION } from '@waha/version';
|
||||
import * as lodash from 'lodash';
|
||||
@@ -89,7 +90,7 @@ export class ServerController {
|
||||
'so you can use this endpoint to restart the server',
|
||||
})
|
||||
@UsePipes(new WAHAValidationPipe())
|
||||
async stop(@Body() request: StopRequest) {
|
||||
async stop(@Body() request: StopRequest): Promise<StopResponse> {
|
||||
const timeout = 1_000;
|
||||
if (request.force) {
|
||||
this.logger.log(`Force stopping the server in ${timeout}ms`);
|
||||
@@ -109,6 +110,7 @@ export class ServerController {
|
||||
process.exit(0);
|
||||
}, timeout);
|
||||
}
|
||||
return { stopping: true };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,14 @@ export class StopRequest {
|
||||
force: boolean = false;
|
||||
}
|
||||
|
||||
export class StopResponse {
|
||||
@ApiProperty({
|
||||
example: true,
|
||||
description: "Always 'true' if the server is stopping.",
|
||||
})
|
||||
stopping: boolean = true;
|
||||
}
|
||||
|
||||
export class ServerStatusResponse {
|
||||
@ApiProperty({
|
||||
example: 1723788847247,
|
||||
|
||||
Reference in new issue
Block a user