|
|
@@ -25,7 +25,7 @@ import {
|
|
|
} from '../../rabbitmq/rabbitmq-publisher.service';
|
|
|
import { AdsClickEventPayload } from '@box/common/events/ads-click-event.dto';
|
|
|
import { randomUUID } from 'crypto';
|
|
|
-import { nowEpochMsBigInt } from '@box/common/time/time.util';
|
|
|
+import { nowEpochMsBigInt, nowSecBigInt } from '@box/common/time/time.util';
|
|
|
|
|
|
// This should match what mgnt-side rebuildSingleAdCache stores.
|
|
|
// We only care about a subset for now.
|
|
|
@@ -278,7 +278,7 @@ export class AdService {
|
|
|
|
|
|
// Query MongoDB for full ad details
|
|
|
try {
|
|
|
- const now = BigInt(Math.floor(Date.now() / 1000));
|
|
|
+ const now = nowSecBigInt();
|
|
|
const ads = await this.mongoPrisma.ads.findMany({
|
|
|
where: {
|
|
|
id: { in: adIds },
|
|
|
@@ -403,7 +403,7 @@ export class AdService {
|
|
|
// Step 4: Query MongoDB for full ad details
|
|
|
let ads: Awaited<ReturnType<typeof this.mongoPrisma.ads.findMany>>;
|
|
|
try {
|
|
|
- const now = BigInt(Math.floor(Date.now() / 1000));
|
|
|
+ const now = nowSecBigInt();
|
|
|
ads = await this.mongoPrisma.ads.findMany({
|
|
|
where: {
|
|
|
id: { in: adIds },
|
|
|
@@ -496,7 +496,7 @@ export class AdService {
|
|
|
`Ad cache miss: adsId=${adsId}, key=${adKey}, falling back to MongoDB`,
|
|
|
);
|
|
|
|
|
|
- const now = BigInt(Math.floor(Date.now() / 1000));
|
|
|
+ const now = nowSecBigInt();
|
|
|
const ad = await this.mongoPrisma.ads.findUnique({
|
|
|
where: { id: adsId },
|
|
|
select: {
|