mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 04:04:55 +08:00
fix(kafka): fix kafka timestamps sent from application (#4709)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -259,7 +259,7 @@ impl KafkaProducer {
|
||||
.timestamp(
|
||||
event
|
||||
.creation_timestamp()
|
||||
.unwrap_or_else(|| OffsetDateTime::now_utc().unix_timestamp()),
|
||||
.unwrap_or_else(|| OffsetDateTime::now_utc().unix_timestamp() * 1_000),
|
||||
),
|
||||
)
|
||||
.map_err(|(error, record)| report!(error).attach_printable(format!("{record:?}")))
|
||||
@ -476,7 +476,7 @@ impl MessagingInterface for KafkaProducer {
|
||||
.key(&data.identifier())
|
||||
.payload(&json_data)
|
||||
.timestamp(
|
||||
(timestamp.assume_utc().unix_timestamp_nanos() / 1_000)
|
||||
(timestamp.assume_utc().unix_timestamp_nanos() / 1_000_000)
|
||||
.to_i64()
|
||||
.unwrap_or_else(|| {
|
||||
// kafka producer accepts milliseconds
|
||||
|
||||
@ -70,10 +70,6 @@ impl<'a> super::KafkaMessage for KafkaDispute<'a> {
|
||||
)
|
||||
}
|
||||
|
||||
fn creation_timestamp(&self) -> Option<i64> {
|
||||
Some(self.modified_at.unix_timestamp())
|
||||
}
|
||||
|
||||
fn event_type(&self) -> crate::events::EventType {
|
||||
crate::events::EventType::Dispute
|
||||
}
|
||||
|
||||
@ -108,10 +108,6 @@ impl<'a> super::KafkaMessage for KafkaPaymentAttempt<'a> {
|
||||
)
|
||||
}
|
||||
|
||||
fn creation_timestamp(&self) -> Option<i64> {
|
||||
Some(self.modified_at.unix_timestamp())
|
||||
}
|
||||
|
||||
fn event_type(&self) -> crate::events::EventType {
|
||||
crate::events::EventType::PaymentAttempt
|
||||
}
|
||||
|
||||
@ -66,10 +66,6 @@ impl<'a> super::KafkaMessage for KafkaPaymentIntent<'a> {
|
||||
format!("{}_{}", self.merchant_id, self.payment_id)
|
||||
}
|
||||
|
||||
fn creation_timestamp(&self) -> Option<i64> {
|
||||
Some(self.modified_at.unix_timestamp())
|
||||
}
|
||||
|
||||
fn event_type(&self) -> crate::events::EventType {
|
||||
crate::events::EventType::PaymentIntent
|
||||
}
|
||||
|
||||
@ -80,10 +80,6 @@ impl<'a> super::KafkaMessage for KafkaPayout<'a> {
|
||||
format!("{}_{}", self.merchant_id, self.payout_attempt_id)
|
||||
}
|
||||
|
||||
fn creation_timestamp(&self) -> Option<i64> {
|
||||
Some(self.last_modified_at.unix_timestamp())
|
||||
}
|
||||
|
||||
fn event_type(&self) -> crate::events::EventType {
|
||||
crate::events::EventType::Payout
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user