我的错误日志正在填充这个无用的文本,我已经将我的工作设置为只尝试一次,时间为0,因为作业可能非常长并且取决于用户。
因此作业尝试设置为1超时为0,在laravel forge上我已将我的工作人员设置为最大尝试次数为1且超时0,并且它仍然在日志中给出了这个错误:
Illuminate\Queue\MaxAttemptsExceededException: A queued job has been attempted too many times. The job may have previously timed out. in /home/forge/Altpocket.io/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:385
Stack trace:
#0 /home/forge/Altpocket.io/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(311): Illuminate\Queue\Worker->markJobAsFailedIfAlreadyExceedsMaxAttempts('beanstalkd', Object(Illuminate\Queue\Jobs\BeanstalkdJob), 1)
#1 /home/forge/Altpocket.io/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(267): Illuminate\Queue\Worker->process('beanstalkd', Object(Illuminate\Queue\Jobs\BeanstalkdJob), Object(Illuminate\Queue\WorkerOptions))
#2 /home/forge/Altpocket.io/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(113): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\BeanstalkdJob), 'beanstalkd', Object(Illuminate\Queue\WorkerOptions))
#3 /home/forge/Altpocket.io/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(101): Illuminate\Queue\Worker->daemon('beanstalkd', 'default', Object(Illuminate\Queue\WorkerOptions))
#4 /home/forge/Altpocket.io/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(84): Illuminate\Queue\Console\WorkCommand->runWorker('beanstalkd', 'default')
#5 [internal function]: Illuminate\Queue\Console\WorkCommand->fire()
#6 /home/forge/Altpocket.io/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array)
#7 /home/forge/Altpocket.io/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#8 /home/forge/Altpocket.io/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#9 /home/forge/Altpocket.io/vendor/laravel/framework/src/Illuminate/Container/Container.php(539): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#10 /home/forge/Altpocket.io/vendor/laravel/framework/src/Illuminate/Console/Command.php(182): Illuminate\Container\Container->call(Array)
#11 /home/forge/Altpocket.io/vendor/symfony/console/Command/Command.php(240): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#12 /home/forge/Altpocket.io/vendor/laravel/framework/src/Illuminate/Console/Command.php(167): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#13 /home/forge/Altpocket.io/vendor/symfony/console/Application.php(860): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /home/forge/Altpocket.io/vendor/symfony/console/Application.php(218): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /home/forge/Altpocket.io/vendor/symfony/console/Application.php(122): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /home/forge/Altpocket.io/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(122): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /home/forge/Altpocket.io/artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 {main}
这是我的工作:
<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use App\Events\PushEvent;
use Cache;
class ImportBittrex implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*
* @return void
*/
protected $userid;
protected $withdraws;
protected $cachekey;
public $tries = 1;
public $timeout = 0;
public function __construct($userid, $withdraws)
{
$this->userid = $userid;
$this->withdraws = $withdraws;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$this->cachekey = 'Import-Bittrex2'.$this->userid;
if(Cache::get($this->cachekey) !== null) {
event(new PushEvent('You already have an import running!', 'error', $this->userid));
return $this->userid;
}
Cache::put($this->cachekey, 1, 5);
app('App\Http\Controllers\ImportController')->importDepositsB($this->userid);
app('App\Http\Controllers\ImportController')->importTradesB($this->userid);
app('App\Http\Controllers\ImportController')->insertBuysB($this->userid);
app('App\Http\Controllers\ImportController')->importWithdrawsB($this->userid, $this->withdraws);
app('App\Http\Controllers\ImportController')->insertSellsB($this->userid);
app('App\Http\Controllers\ImportController')->importBalancesB($this->userid);
app('App\Http\Controllers\ImportController')->safeBittrexCheck($this->userid);
Cache::forget('investments'.$this->userid);
Cache::forget('b_investments'.$this->userid);
Cache::forget('deposits'.$this->userid);
Cache::forget('withdraws'.$this->userid);
Cache::forget('balances'.$this->userid);
Cache::forget('balances-summed'.$this->userid);
Cache::forget('deposits'.$this->userid);
Cache::forget('withdraws'.$this->userid);
Cache::forget($this->cachekey);
}
}
这是laravel forge的工作人员:
https://i.imgur.com/lz22zMX.png
这里有什么问题?为什么会这种情况继续发生。
基本上在作业中运行的第一个函数中,它将检查用户是否具有有效的api组合键,如果它没有捕获它并抛出错误,如下所示:
https://i.imgur.com/zldnUnT.png
请帮助我,我正在失去理智。