mirror of
https://github.com/muerwre/vk-tg-bot.git
synced 2025-04-25 23:16:41 +07:00
#5 added healthcheck
This commit is contained in:
parent
46d24cd9dd
commit
dd3c281af9
6 changed files with 37 additions and 4 deletions
|
@ -43,4 +43,5 @@ export interface Storage {
|
|||
vkPostId: number
|
||||
): Promise<Post | undefined>;
|
||||
findPostByEvent(eventId: number): Promise<Post | undefined>;
|
||||
healthcheck(): Promise<void>;
|
||||
}
|
||||
|
|
|
@ -127,4 +127,8 @@ export class PostgresDB implements Storage {
|
|||
createPost = async (eventId: number, text: string, vkPostId: number) => {
|
||||
return this.posts.save({ eventId, text, vkPostId });
|
||||
};
|
||||
|
||||
healthcheck = async () => {
|
||||
await this.connection.query("SELECT 1");
|
||||
};
|
||||
}
|
||||
|
|
|
@ -96,11 +96,22 @@ export class TelegramService {
|
|||
});
|
||||
};
|
||||
|
||||
stop = (signal: string) => {
|
||||
/**
|
||||
* Stops service
|
||||
* @param signal
|
||||
*/
|
||||
public stop = (signal: string) => {
|
||||
if (!this.isWebhookEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.bot.stop(signal);
|
||||
};
|
||||
|
||||
/**
|
||||
* Performs healthcheck for telegram
|
||||
*/
|
||||
public healthcheck = async () => {
|
||||
await this.bot.telegram.getMe();
|
||||
};
|
||||
}
|
||||
|
|
|
@ -133,4 +133,11 @@ export class VkService {
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs healthcheck for telegram
|
||||
*/
|
||||
public healthcheck = async () => {
|
||||
await this.db.healthcheck();
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue