Skip to content

Commit

Permalink
fix implementation of skip logic (skip more events)
Browse files Browse the repository at this point in the history
  • Loading branch information
pk910 committed Nov 6, 2023
1 parent b36570e commit 46be3f1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/modules/ipinfo/IPInfoModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ export class IPInfoModule extends BaseModule<IIPInfoConfig> {
}

private async processSessionRewardFactor(session: FaucetSession, rewardFactors: ISessionRewardFactor[]) {
if(session.getSessionData<Array<string>>("skip.modules", []).indexOf(this.moduleName) !== -1)
return;
let refreshTime = session.getSessionModuleRef("ipinfo.restriction.time") || 0;
let now = Math.floor((new Date()).getTime() / 1000);
let sessionRestriction: IIPInfoRestriction;
Expand Down
4 changes: 4 additions & 0 deletions src/modules/passport/PassportModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ export class PassportModule extends BaseModule<IPassportConfig> {
}

private async processSessionInfo(session: FaucetSession, moduleState: any): Promise<void> {
if(session.getSessionData<Array<string>>("skip.modules", []).indexOf(this.moduleName) !== -1)
return;
if(session.getSessionStatus() !== FaucetSessionStatus.RUNNING)
return;
let passportInfo: IPassportInfo = session.getSessionData("passport.data");
Expand All @@ -87,6 +89,8 @@ export class PassportModule extends BaseModule<IPassportConfig> {
}

private processSessionRewardFactor(session: FaucetSession, rewardFactors: ISessionRewardFactor[]): void {
if(session.getSessionData<Array<string>>("skip.modules", []).indexOf(this.moduleName) !== -1)
return;
let passportInfo: IPassportInfo = session.getSessionData("passport.data");
if(!passportInfo)
return;
Expand Down
6 changes: 6 additions & 0 deletions src/modules/pow/PoWModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ export class PoWModule extends BaseModule<IPoWConfig> {
}

private async processSessionInfo(session: FaucetSession, moduleState: any): Promise<void> {
if(session.getSessionData<Array<string>>("skip.modules", []).indexOf(this.moduleName) !== -1)
return;
if(session.getSessionStatus() !== FaucetSessionStatus.RUNNING)
return;
let powSession = this.getPoWSession(session);
Expand All @@ -130,11 +132,15 @@ export class PoWModule extends BaseModule<IPoWConfig> {
}

private async processSessionRestore(session: FaucetSession): Promise<void> {
if(session.getSessionData<Array<string>>("skip.modules", []).indexOf(this.moduleName) !== -1)
return;
let powSession = this.getPoWSession(session);
this.resetSessionIdleTimer(powSession);
}

private async processSessionComplete(session: FaucetSession): Promise<void> {
if(session.getSessionData<Array<string>>("skip.modules", []).indexOf(this.moduleName) !== -1)
return;
setTimeout(() => {
let powSession = this.getPoWSession(session);
if(session.getSessionStatus() === FaucetSessionStatus.FAILED)
Expand Down
2 changes: 2 additions & 0 deletions src/modules/recurring-limits/RecurringLimitsModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ export class RecurringLimitsModule extends BaseModule<IRecurringLimitsConfig> {
}

private async processSessionRewardFactor(session: FaucetSession, rewardFactors: ISessionRewardFactor[]) {
if(session.getSessionData<Array<string>>("skip.modules", []).indexOf(this.moduleName) !== -1)
return;
let rewardPerc = session.getSessionData("recurring-limits.factor", 100);
if(rewardPerc !== 100) {
rewardFactors.push({
Expand Down

0 comments on commit 46be3f1

Please sign in to comment.