99use Illuminate \Queue \InteractsWithQueue ;
1010use Illuminate \Queue \SerializesModels ;
1111use Illuminate \Support \Facades \Cache ;
12- use Illuminate \Support \Facades \Log ;
1312
1413class ProcessAggregatedEvents implements ShouldQueue
1514{
@@ -20,15 +19,12 @@ class ProcessAggregatedEvents implements ShouldQueue
2019
2120 protected string $ nodeId ;
2221
23- protected GithubService $ githubService ;
24-
2522 /**
2623 * Create a new job instance.
2724 */
28- public function __construct (string $ nodeId, GithubService $ githubService )
25+ public function __construct (string $ nodeId )
2926 {
3027 $ this ->nodeId = $ nodeId ;
31- $ this ->githubService = $ githubService ;
3228 }
3329
3430 /**
@@ -41,19 +37,19 @@ public function handle(): void
4137 /** @var array<string, mixed> $eventMessages */
4238 $ eventMessages = Cache::pull ($ commentAggregationCacheKey , []);
4339
44- Log::info ('ProcessAggregatedEvents: Event message: ' .json_encode ($ eventMessages ));
4540 $ message = $ this ->aggregateMessages ($ eventMessages );
41+ $ author = Cache::pull ($ commentAggregationCacheKey .'_author ' , []);
42+
4643 Cache::forget ($ commentAggregationCacheKey );
47- $ author = Cache::pull ($ commentAggregationCacheKey .'_author ' , ' ' );
44+ Cache::forget ($ commentAggregationCacheKey .'_author ' );
4845
49- Log::info ('ProcessAggregatedEvents: Author: ' .$ author );
5046 $ message .= '\n\n ' .view (
5147 'github-project::md.shared.author ' ,
5248 ['name ' => $ author ['name ' ], 'html_url ' => $ author ['html_url ' ]]
5349 )->render ();
5450
55- Log:: info ( ' ProcessAggregatedEvents: Message: ' . $ message );
56- $ this -> githubService ->commentOnNode ($ this ->nodeId , $ message );
51+ $ githubService = new GithubService ( );
52+ $ githubService ->commentOnNode ($ this ->nodeId , $ message );
5753 }
5854
5955 /**
0 commit comments