okipa/laravel-stuck-jobs-notifier

当检测到停滞任务时接收通知。

2.4.0 2023-01-22 22:48 UTC

This package is auto-updated.

Last update: 2024-09-19 23:24:50 UTC


README

Laravel Stuck Jobs Notifier

Latest Stable Version Total Downloads Build Status Coverage Status License: MIT

当定义时间内有停滞任务时,接收通知并执行PHP回调。

可以通过邮件、Slack和webhooks(聊天通常提供webhook API)发送通知。

如果觉得这个包很有用,请考虑支持我的工作!

Donate Donate

兼容性

升级指南

目录

安装

使用composer安装此包

composer require okipa/laravel-stuck-jobs-notifier

如果您打算发送Slack通知,您需要安装

composer require laravel/slack-notification-channel

如果您打算发送webhook通知,您需要安装

composer require laravel-notification-channels/webhook

配置

发布包配置

php artisan vendor:publish --tag=stuck-jobs-notifier:config

翻译

此包中使用的所有单词和句子都是可翻译的。

请参阅Laravel官方文档了解如何翻译它们:https://laravel.net.cn/docs/localization#using-translation-strings-as-keys

以下是默认可翻译的单词和句子列表

* {1}[:app - :env] :count job is stuck in queue|[2,*][:app - :env] :count jobs are stuck in queue
* {1}We have detected that :count job is stuck in the [:app - :env](:url) queue since the :day at :hour.|[2,*]We have detected that :count jobs are stuck in the [:app - :env](:url) queue since the :day at :hour.
* Please check your stuck jobs connecting to your server and executing the "php artisan queue:failed" command.
* {1}`[:app - :env]` :count job is stuck in the :url queue since the :day at :hour.|[2,*]`[:app - :env]` :count jobs are stuck in the :url queue since the :day at :hour.
* {1}:count job is stuck in queue since the :day at :hour.|[2,*]:count jobs are stuck in queue since the :day at :hour.
* Notification test:
* Exception test:

用法

只需将此命令添加到您的\App\Console\Kernel类的schedule()方法中

$schedule->command('queue:stuck:notify')->twiceDaily(10, 16);

然后,当配置的天数内有任务在failed_jobs表中停滞时,您将立即收到通知。

一切设置完成后,您可以通过模拟停滞任务检测来检查配置是否正确。

php artisan queue:stuck:simulate

测试

composer test

变更日志

有关最近更改的详细信息,请参阅变更日志

贡献

有关详细信息,请参阅贡献

致谢

许可

MIT许可(MIT)。有关更多信息,请参阅许可文件