Improve village scan

This commit is contained in:
Anton Vakhrushev 2020-04-20 09:42:45 +03:00
parent bcfb52cb98
commit 28566c4941
4 changed files with 3 additions and 16 deletions

View File

@ -1,12 +0,0 @@
import { ActionController, registerAction } from './ActionController';
import { Args } from '../Command';
import { Task } from '../Queue/TaskQueue';
import { StateGrabberManager } from '../Grabber/StateGrabberManager';
@registerAction
export class StoreVillageState extends ActionController {
async run(args: Args, task: Task): Promise<any> {
const manager = new StateGrabberManager();
manager.grab();
}
}

View File

@ -55,6 +55,8 @@ export class Executor {
this.logger.log('CURRENT JOB', 'TASK', taskCommand, 'ACTION', actionCommand); this.logger.log('CURRENT JOB', 'TASK', taskCommand, 'ACTION', actionCommand);
this.runGrabbers();
try { try {
if (actionCommand) { if (actionCommand) {
return await this.processActionCommand(actionCommand, taskCommand); return await this.processActionCommand(actionCommand, taskCommand);
@ -69,7 +71,6 @@ export class Executor {
} }
private async processActionCommand(cmd: Command, task: Task) { private async processActionCommand(cmd: Command, task: Task) {
this.runGrabbers();
const actionController = createAction(cmd.name, this.scheduler); const actionController = createAction(cmd.name, this.scheduler);
this.logger.log('PROCESS ACTION', cmd.name, actionController); this.logger.log('PROCESS ACTION', cmd.name, actionController);
if (actionController) { if (actionController) {

View File

@ -26,7 +26,7 @@ export class Scheduler {
// this.taskQueue.push(UpdateResourceContracts.name, {}, timestamp()); // this.taskQueue.push(UpdateResourceContracts.name, {}, timestamp());
// this.taskQueue.push(BalanceHeroResourcesTask.name, {}, timestamp()); // this.taskQueue.push(BalanceHeroResourcesTask.name, {}, timestamp());
this.createUniqTaskTimer(3 * 60, GrabVillageState.name); this.createUniqTaskTimer(2 * 60, GrabVillageState.name);
this.createUniqTaskTimer(10 * 60, UpdateResourceContracts.name); this.createUniqTaskTimer(10 * 60, UpdateResourceContracts.name);
this.createUniqTaskTimer(20 * 60, BalanceHeroResourcesTask.name); this.createUniqTaskTimer(20 * 60, BalanceHeroResourcesTask.name);
this.createUniqTaskTimer(60 * 60, SendOnAdventureTask.name); this.createUniqTaskTimer(60 * 60, SendOnAdventureTask.name);

View File

@ -5,7 +5,6 @@ import { path } from '../utils';
import { Task } from '../Queue/TaskQueue'; import { Task } from '../Queue/TaskQueue';
import { TaskController, registerTask } from './TaskController'; import { TaskController, registerTask } from './TaskController';
import { grabVillageList } from '../Page/VillageBlock'; import { grabVillageList } from '../Page/VillageBlock';
import { StoreVillageState } from '../Action/StoreVillageState';
@registerTask @registerTask
export class GrabVillageState extends TaskController { export class GrabVillageState extends TaskController {
@ -22,7 +21,6 @@ export class GrabVillageState extends TaskController {
path: path('/dorf1.php', { newdid: village.id }), path: path('/dorf1.php', { newdid: village.id }),
}) })
); );
actions.push(new Command(StoreVillageState.name, args));
} }
actions.push(new Command(CompleteTaskAction.name, args)); actions.push(new Command(CompleteTaskAction.name, args));