Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: gap expiration time #498

Merged
merged 2 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion worker-service/example.env
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,9 @@ GOV_ACTION_PROPOSALS_PER_PAGE=10

# Scheduler DB-SYNC
VOTES_JOB_FREQUENCY=*/30 * * * * *
GOV_ACTION_PROPOSALS_JOB_FREQUENCY=0 * * * * *
GOV_ACTION_PROPOSALS_JOB_FREQUENCY=0 * * * * *

# Epoch duration in seconds
EPOCH_DURATION=86400
# GAP duration in epoch count
GAP_DURATION_IN_EPOCH_COUNT=6
6 changes: 6 additions & 0 deletions worker-service/src/common/common-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,10 @@ export abstract class CommonService {
}
return ipfsUrl; // Return the original URL if it doesn't start with ipfs://
}

async getEndTime(startTime: Date, interval: number): Promise<Date> {
const startDate = new Date(startTime);
const endTime = new Date(startDate.getTime() + interval * 1000);
return endTime;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export class GovActionProposalRequest {
govActionType: string;
govMetadataUrl: string;
status: string;
endTime: string;
endTime: Date;
txHash: string;
submitTime: string;
submitTime: Date;
}
56 changes: 28 additions & 28 deletions worker-service/src/governance/facade/governance.facade.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ describe('GovernanceFacade', () => {
govMetadataUrl:
'https://raw.githubusercontent.com/mpawel79/testrepo/master/Info.jsonld',
status: 'DROPPED',
submitTime: '2024-05-21 15:18:06.000',
endTime: '2024-05-26T22:29:45.000Z',
submitTime: new Date('2024-05-21 15:18:06.000'),
endTime: new Date('2024-05-26T22:29:45.000Z'),
txHash:
'D775FBCB6006524ABBFFE6DAF538E71941745B44A3A735852FBBD49FD7D59A95',
},
Expand All @@ -38,8 +38,8 @@ describe('GovernanceFacade', () => {
govMetadataUrl:
'https://raw.githubusercontent.com/mpawel79/testrepo/master/Info.jsonld',
status: 'DROPPED',
submitTime: '2024-05-21 17:08:38.000',
endTime: '2024-05-26T22:29:45.000Z',
submitTime: new Date('2024-05-21 17:08:38.000'),
endTime: new Date('2024-05-26T22:29:45.000Z'),
txHash:
'DB4DBEB5946E5D49778F457D9C5A460488C40AF0B93D8B98111F5BE11BF165A6',
},
Expand All @@ -50,8 +50,8 @@ describe('GovernanceFacade', () => {
govMetadataUrl:
'1111111111111111111111111111111111111111111111111111111111111111',
status: 'DROPPED',
submitTime: '2024-05-22 10:08:20.000',
endTime: '2024-05-27T22:29:38.000Z',
submitTime: new Date('2024-05-22 10:08:20.000'),
endTime: new Date('2024-05-27T22:29:38.000Z'),
txHash:
'67820C121787464A9B670CF4C648F67CABD9573EB71B220214971CE467D25027',
},
Expand All @@ -61,8 +61,8 @@ describe('GovernanceFacade', () => {
govActionType: 'InfoAction',
govMetadataUrl: 'https://my-ip.at/test/cip-0100.common.json',
status: 'DROPPED',
submitTime: '2024-05-17 12:56:00.000',
endTime: '2024-05-17 12:56:00.000',
submitTime: new Date('2024-05-17 12:56:00.000'),
endTime: new Date('2024-05-17 12:56:00.000'),
txHash:
'69AA81F4AA0140E8D2AB2B6642C403611CD730FAB42E6C9F9E3E15D6D90BD3E9',
},
Expand All @@ -73,8 +73,8 @@ describe('GovernanceFacade', () => {
govMetadataUrl:
'https://github.com/carloslodelar/proposals/blob/main/why-hardfork-to-10.txt',
status: 'DROPPED',
submitTime: '2024-05-17 16:15:34.000',
endTime: '2024-05-22T22:29:33.000Z',
submitTime: new Date('2024-05-17 16:15:34.000'),
endTime: new Date('2024-05-22T22:29:33.000Z'),
txHash:
'EDEF927AF962664ED7A02BEDFA913C7F1CD271494871C25EE7DE66E941D83C79',
},
Expand All @@ -85,8 +85,8 @@ describe('GovernanceFacade', () => {
govMetadataUrl:
'https://raw.githubusercontent.com/Sworzen1/Testing-Todo-app/main/Treasury.jsonld',
status: 'DROPPED',
submitTime: '2024-05-27 09:19:00.000',
endTime: '2024-06-01T22:29:51.000Z',
submitTime: new Date('2024-05-27 09:19:00.000'),
endTime: new Date('2024-06-01T22:29:51.000Z'),
txHash:
'2C2F01F6818CEE5E2EC29EF965DF347099173707BAFCEFC7F6FE3D66CD5F66EC',
},
Expand All @@ -97,8 +97,8 @@ describe('GovernanceFacade', () => {
govMetadataUrl:
'https://raw.githubusercontent.com/Ryun1/metadata/main/cip100/ga.jsonld',
status: 'DROPPED',
submitTime: '2024-05-27 20:34:28.000',
endTime: '2024-06-01T22:29:51.000Z',
submitTime: new Date('2024-05-27 20:34:28.000'),
endTime: new Date('2024-06-01T22:29:51.000Z'),
txHash:
'3B15AC25580564C8C565121188B142BEE99F6AAD7D4130FFC6A5A764EBA1159A',
},
Expand All @@ -108,8 +108,8 @@ describe('GovernanceFacade', () => {
govActionType: 'ParameterChange',
govMetadataUrl: 'https://my-ip.at/test/cip-0100.common.json',
status: 'DROPPED',
submitTime: '2024-05-18 20:25:26.000',
endTime: '2024-05-23T22:27:46.000Z',
submitTime: new Date('2024-05-18 20:25:26.000'),
endTime: new Date('2024-05-23T22:27:46.000Z'),
txHash:
'6A3319F5AC57551C4CABF77D0603BD6C72F44E9D10830363D87EB34CB43AFCB2',
},
Expand All @@ -119,8 +119,8 @@ describe('GovernanceFacade', () => {
govActionType: 'InfoAction',
govMetadataUrl: 'https://metadata.cardanoapi.io/data/Info',
status: 'DROPPED',
submitTime: '2024-05-18 14:29:22.000',
endTime: '2024-05-23T22:27:46.000Z',
submitTime: new Date('2024-05-18 14:29:22.000'),
endTime: new Date('2024-05-23T22:27:46.000Z'),
txHash:
'B9532421430F6611C0170993E88DFA29B6AA0D4CCE024AD88346C59BE2B65B41',
},
Expand All @@ -130,8 +130,8 @@ describe('GovernanceFacade', () => {
govActionType: 'InfoAction',
govMetadataUrl: 'https://metadata.cardanoapi.io/data/Info',
status: 'DROPPED',
submitTime: '2024-05-26 04:02:39.000',
endTime: '2024-05-31T22:29:15.000Z',
submitTime: new Date('2024-05-26 04:02:39.000'),
endTime: new Date('2024-05-31T22:29:15.000Z'),
txHash:
'2EC4AD524F0AF3EEB1F05C360BFDECF815936E7CBF8EAC9C07A4E0C7072D03D1',
},
Expand All @@ -144,8 +144,8 @@ describe('GovernanceFacade', () => {
govActionType: 'InfoAction',
govMetadataUrl: 'https://bit.ly/3zCH2HL',
status: 'DROPPED',
submitTime: '2024-05-20 06:39:16.000',
endTime: '2024-05-25T22:29:48.000Z',
submitTime: new Date('2024-05-20 06:39:16.000'),
endTime: new Date('2024-05-25T22:29:48.000Z'),
txHash:
'cef93aface365b575e1f33987fad4093e2a8a06d31c01a260e0e7db325fc0b50',
},
Expand All @@ -155,8 +155,8 @@ describe('GovernanceFacade', () => {
govActionType: 'InfoAction',
govMetadataUrl: 'https://metadata.cardanoapi.io/data/Info',
status: 'DROPPED',
submitTime: '2024-05-22 12:24:59.000',
endTime: '2024-05-27T22:29:38.000Z',
submitTime: new Date('2024-05-22 12:24:59.000'),
endTime: new Date('2024-05-27T22:29:38.000Z'),
txHash:
'75d1c676f459f1192c7fd2c73423635a074c5e7b46497e00f44428861f460153',
},
Expand All @@ -167,8 +167,8 @@ describe('GovernanceFacade', () => {
govMetadataUrl:
'https://raw.githubusercontent.com/mpawel79/testrepo/master/Info.jsonld',
status: 'DROPPED',
submitTime: '2024-05-22 19:47:27.000',
endTime: '2024-05-27T22:29:38.000Z',
submitTime: new Date('2024-05-22 19:47:27.000'),
endTime: new Date('2024-05-27T22:29:38.000Z'),
txHash:
'9bd2b6547ab8e8ed5c34049d6b984772a8352ac70e92198e1a7f6cdbb12d6397',
},
Expand All @@ -179,8 +179,8 @@ describe('GovernanceFacade', () => {
govMetadataUrl:
'https://raw.githubusercontent.com/mpawel79/testrepo/master/Info.jsonld',
status: 'DROPPED',
submitTime: '2024-05-22 21:44:26.000',
endTime: '2024-05-27T22:29:38.000Z',
submitTime: new Date('2024-05-22 21:44:26.000'),
endTime: new Date('2024-05-27T22:29:38.000Z'),
txHash:
'f6ca72e9fe225c01e1a622d529ad807d668a786cb28d1eb352b8da58b66dd8c2',
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OnWorkerEvent, Processor, WorkerHost } from '@nestjs/bullmq';
import { Processor, WorkerHost } from '@nestjs/bullmq';
import { Job } from 'bullmq';
import {
JOB_NAME_GOV_ACTIONS_SYNC,
Expand All @@ -7,12 +7,11 @@ import {
import { Logger } from '@nestjs/common';
import { GovActionProposalService } from '../../services/gov-action-proposal.service';


@Processor(QUEUE_NAME_DB_SYNC_GOV_ACTIONS)
export class GovActionsProposalProcessor extends WorkerHost {
protected readonly logger = new Logger(GovActionsProposalProcessor.name);
constructor(
private readonly govActionProposalService: GovActionProposalService
private readonly govActionProposalService: GovActionProposalService,
) {
super();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OnWorkerEvent, Processor, WorkerHost } from '@nestjs/bullmq';
import { Processor, WorkerHost } from '@nestjs/bullmq';
import { Job } from 'bullmq';
import {
JOB_NAME_VOTE_SYNC,
Expand Down
Loading
Loading