Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

queue job No query results for model #24409

Closed
juchao1989 opened this issue Jun 1, 2018 · 5 comments
Closed

queue job No query results for model #24409

juchao1989 opened this issue Jun 1, 2018 · 5 comments

Comments

@juchao1989
Copy link

  • Laravel Version: 5.5
  • PHP Version:7.0
  • Database Driver & Version:mysql

Description: !!!please help me!!!

!!!!Frequency of occurrence, every 1000 times!!!!
!!!on sqs queue!!!
!!!on redis queue!!!

Illuminate\Database\Eloquent\ModelNotFoundException: No query results for model [App\Models\Transaction]. in /var/www/api_imex/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:416
Stack trace:
#0 /var/www/api_imex/vendor/laravel/framework/src/Illuminate/Queue/SerializesAndRestoresModelIdentifiers.php(54): Illuminate\Database\Eloquent\Builder->firstOrFail()
#1 /var/www/api_imex/vendor/laravel/framework/src/Illuminate/Queue/SerializesModels.php(41): App\Jobs\DealingWithTransactions->getRestoredPropertyValue(Object(Illuminate\Contracts\Database\ModelIdentifier))
#2 [internal function]: App\Jobs\DealingWithTransactions->__wakeup()
#3 /var/www/api_imex/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(42): unserialize('O:32:"App\Jobs\...')
#4 /var/www/api_imex/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(76): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\SqsJob), Array)
#5 /var/www/api_imex/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(320): Illuminate\Queue\Jobs\Job->fire()
#6 /var/www/api_imex/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(270): Illuminate\Queue\Worker->process('usdt_btc', Object(Illuminate\Queue\Jobs\SqsJob), Object(Illuminate\Queue\WorkerOptions))
#7 /var/www/api_imex/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(114): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\SqsJob), 'usdt_btc', Object(Illuminate\Queue\WorkerOptions))
#8 /var/www/api_imex/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(101): Illuminate\Queue\Worker->daemon('usdt_btc', 'BtcUsdtMatcheng...', Object(Illuminate\Queue\WorkerOptions))
#9 /var/www/api_imex/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(85): Illuminate\Queue\Console\WorkCommand->runWorker('usdt_btc', 'BtcUsdtMatcheng...')
#10 [internal function]: Illuminate\Queue\Console\WorkCommand->handle()
#11 /var/www/api_imex/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array)
#12 /var/www/api_imex/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container{closure}()
#13 /var/www/api_imex/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#14 /var/www/api_imex/vendor/laravel/framework/src/Illuminate/Container/Container.php(549): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#15 /var/www/api_imex/vendor/laravel/framework/src/Illuminate/Console/Command.php(183): Illuminate\Container\Container->call(Array)
#16 /var/www/api_imex/vendor/symfony/console/Command/Command.php(252): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#17 /var/www/api_imex/vendor/laravel/framework/src/Illuminate/Console/Command.php(170): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#18 /var/www/api_imex/vendor/symfony/console/Application.php(946): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /var/www/api_imex/vendor/symfony/console/Application.php(248): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /var/www/api_imex/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /var/www/api_imex/vendor/laravel/framework/src/Illuminate/Console/Application.php(88): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /var/www/api_imex/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(121): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /var/www/api_imex/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 {main}

Steps To Reproduce:

@sisve
Copy link
Contributor

sisve commented Jun 1, 2018

This happens because you have a job that works with a Transaction model, and that model doesn't exist in the database when the job executes. If you think this is an issue, provide us with working code under the header "Steps To Reproduce". You're not supposed to leave that one blank.

@juchao1989
Copy link
Author

@sisve I am sorry, my english is poor!!!
I wrote a job, put it in the queue, performed about 1000 times, there will be a case where the model could not be found, not every time... Thank you for your reply

@netfireapo
Copy link

@wuqinqiang

because you run multiple times the job add some seconds delay

in your Job

public function __construct($media)
    {
        $this->media = $media;
        $this->onQueue('media');
        $this->delay(5);
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@tillkruss @sisve @juchao1989 @netfireapo and others