Skip to content

Commit 984563f

Browse files
committed
+ save timestamps
1 parent 6804286 commit 984563f

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/Controllers/WorkerController.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ public function queue(Request $request, WorkerInterface $worker, Container $lara
125125
'MessageId' => $request->header('X-Aws-Sqsd-Msgid'),
126126
'ReceiptHandle' => false,
127127
'Attributes' => [
128-
'ApproximateReceiveCount' => $request->header('X-Aws-Sqsd-Receive-Count')
128+
'ApproximateReceiveCount' => $request->header('X-Aws-Sqsd-Receive-Count'),
129+
'SentTimestamp' => strtotime($request->header('X-Aws-Sqsd-First-Received-At', ''))
129130
]
130131
]);
131132

src/Jobs/AwsJob.php

+10
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,16 @@ public function attempts()
8787
return (int) $this->job['Attributes']['ApproximateReceiveCount'];
8888
}
8989

90+
/**
91+
* Get the UNIX timestamp of the message creation.
92+
*
93+
* @return int
94+
*/
95+
public function timestamp()
96+
{
97+
return (int) round($this->job['Attributes']['SentTimestamp'] / 1000);
98+
}
99+
90100
/**
91101
* Get the job identifier.
92102
*

0 commit comments

Comments
 (0)