NewStatusPipeline.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace App\Jobs\StatusPipeline;
  3. use App\Status;
  4. use Cache;
  5. use Illuminate\Bus\Queueable;
  6. use Illuminate\Contracts\Queue\ShouldQueue;
  7. use Illuminate\Foundation\Bus\Dispatchable;
  8. use Illuminate\Queue\InteractsWithQueue;
  9. use Illuminate\Queue\SerializesModels;
  10. use Redis;
  11. class NewStatusPipeline implements ShouldQueue
  12. {
  13. use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
  14. protected $status;
  15. /**
  16. * Delete the job if its models no longer exist.
  17. *
  18. * @var bool
  19. */
  20. public $deleteWhenMissingModels = true;
  21. /**
  22. * Create a new job instance.
  23. *
  24. * @return void
  25. */
  26. public function __construct(Status $status)
  27. {
  28. $this->status = $status;
  29. }
  30. /**
  31. * Execute the job.
  32. *
  33. * @return void
  34. */
  35. public function handle()
  36. {
  37. $status = $this->status;
  38. StatusEntityLexer::dispatch($status);
  39. if(config('pixelfed.activitypub_enabled') == true) {
  40. StatusActivityPubDeliver::dispatch($status);
  41. }
  42. // Cache::forever('post.'.$status->id, $status);
  43. // $redis = Redis::connection();
  44. // $redis->lpush(config('cache.prefix').':user.'.$status->profile_id.'.posts', $status->id);
  45. }
  46. }