Browse Source

Add function return types

Theophile Sandoz 3 years ago
parent
commit
99a8be2cc4
2 changed files with 9 additions and 9 deletions
  1. 5 5
      query-node/mappings/src/bounty.ts
  2. 4 4
      query-node/mappings/src/scheduler.ts

+ 5 - 5
query-node/mappings/src/bounty.ts

@@ -43,7 +43,7 @@ function fundingPeriodEnd(bounty: Bounty): number {
  * Schedule Periods changes
  */
 
-export function bountyScheduleFundingEnd(store: DatabaseManager, bounty: Bounty) {
+export function bountyScheduleFundingEnd(store: DatabaseManager, bounty: Bounty): void {
   const { fundingType } = bounty
   if (bounty.stage !== BountyStage.Funding || !isBountyFundingLimited(fundingType)) return
 
@@ -56,7 +56,7 @@ export function bountyScheduleFundingEnd(store: DatabaseManager, bounty: Bounty)
   })
 }
 
-export function bountyScheduleWorkSubmissionEnd(store: DatabaseManager, bounty: Bounty) {
+export function bountyScheduleWorkSubmissionEnd(store: DatabaseManager, bounty: Bounty): void {
   if (bounty.stage !== BountyStage.WorkSubmission) return
 
   const workingPeriodEnd = fundingPeriodEnd(bounty) + bounty.workPeriod
@@ -67,7 +67,7 @@ export function bountyScheduleWorkSubmissionEnd(store: DatabaseManager, bounty:
   })
 }
 
-export function bountyScheduleJudgementEnd(store: DatabaseManager, bounty: Bounty) {
+export function bountyScheduleJudgementEnd(store: DatabaseManager, bounty: Bounty): void {
   if (bounty.stage !== BountyStage.Judgment) return
 
   const judgementPeriodEnd = fundingPeriodEnd(bounty) + bounty.workPeriod + bounty.judgingPeriod
@@ -80,7 +80,7 @@ export function bountyScheduleJudgementEnd(store: DatabaseManager, bounty: Bount
   })
 }
 
-function endFundingPeriod(store: DatabaseManager, bounty: Bounty, isFunded = true) {
+function endFundingPeriod(store: DatabaseManager, bounty: Bounty, isFunded = true): Promise<void> {
   bounty.updatedAt = new Date()
   if (isFunded) {
     bounty.stage = BountyStage.WorkSubmission
@@ -91,7 +91,7 @@ function endFundingPeriod(store: DatabaseManager, bounty: Bounty, isFunded = tru
   return store.save<Bounty>(bounty)
 }
 
-function endWorkingPeriod(store: DatabaseManager, bounty: Bounty) {
+function endWorkingPeriod(store: DatabaseManager, bounty: Bounty): Promise<void> {
   bounty.updatedAt = new Date()
   if (bounty.entries?.length) {
     bounty.stage = BountyStage.Judgment

+ 4 - 4
query-node/mappings/src/scheduler.ts

@@ -7,18 +7,18 @@ import { bountyScheduleWorkSubmissionEnd, bountyScheduleFundingEnd, bountySchedu
 let isSchedulerRunning = false
 let toBeScheduled: [number, () => void][] = []
 
-export async function launchScheduler({ store }: StoreContext) {
+export async function launchScheduler({ store }: StoreContext): Promise<void> {
   if (!isSchedulerRunning) {
     runScheduler()
     await scheduleMissedMappings(store)
   }
 }
 
-export function scheduleAtBlock(blockNumber: number, job: () => void) {
+export function scheduleAtBlock(blockNumber: number, job: () => void): void {
   toBeScheduled.push([blockNumber, job])
 }
 
-function runScheduler() {
+function runScheduler(): void {
   isSchedulerRunning = true
   const scheduleRecord: { [n: number]: (() => void)[] } = {}
 
@@ -41,7 +41,7 @@ function runScheduler() {
   })
 }
 
-async function scheduleMissedMappings(store: DatabaseManager) {
+async function scheduleMissedMappings(store: DatabaseManager): Promise<void> {
   // Reschedule mappings lost while the processor was off
 
   // Bounty stage updates