Skip to content

Commit

Permalink
Schedule unstaked (#187)
Browse files Browse the repository at this point in the history
* schedule for unstaked request service with status waiting unstaked.

* scheduler for retrieve unstaked

* import when from jest-when is not used yet

* remove unused import

* from require to import from

* change logic

* lint error

* remove nullable for timeWaitingUnstaked

* resolve package.json

* - change time to next six days from unstaked date
- run interval 30 seconds

Co-authored-by: Hildegard Lydia <[email protected]>
Co-authored-by: Agustinus Theodorus <[email protected]>
  • Loading branch information
3 people authored Dec 23, 2021
1 parent 401d685 commit a2a5189
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
15 changes: 15 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/schedulers/unstaked/unstaked.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class UnstakedService implements OnModuleInit {
await this.handleWaitingUnstaked();
}

@Interval((60 * 1000))
@Interval((30 * 1000))
async handleWaitingUnstaked() {
try {
this.logger.log('Retrieve Unstaked Amount');
Expand All @@ -27,6 +27,7 @@ export class UnstakedService implements OnModuleInit {

const createRequestService = await this.elasticsearchService.search({
index: 'create-service-request',
allow_no_indices: true,
body: {
query: {
match: {
Expand All @@ -52,8 +53,7 @@ export class UnstakedService implements OnModuleInit {

const numberTimeWaitingUnstaked = Number(timeWaitingUnstaked.replace(/,/gi, ""));

// const timeNext6Days = numberTimeWaitingUnstaked + (6 * 24 * 60 * 60 * 1000);
const timeNext6Days = numberTimeWaitingUnstaked + (5 * 60 * 1000);
const timeNext6Days = numberTimeWaitingUnstaked + (6 * 24 * 60 * 60 * 1000);
const timeNow = new Date().getTime();

const diffTime = timeNext6Days - timeNow;
Expand Down

0 comments on commit a2a5189

Please sign in to comment.