diff --git a/src/Dashboard.ts b/src/Dashboard.ts
index 30d35f9..f4388b7 100644
--- a/src/Dashboard.ts
+++ b/src/Dashboard.ts
@@ -1,5 +1,5 @@
import * as URLParse from 'url-parse';
-import { sleep } from './utils';
+import { markPage, sleepShort } from './utils';
import { v4 as uuid } from 'uuid';
import { QueueItem } from './Queue';
import Scheduler from './Scheduler';
@@ -13,14 +13,12 @@ export default class Dashboard {
}
async run() {
- jQuery('body').append(
- '
Dashboard
'
- );
-
const p = new URLParse(window.location.href, true);
console.log('PARSED LOCATION', p);
- await sleep(5000);
+ await sleepShort();
+
+ markPage('Dashboard');
if (p.pathname === '/build.php') {
console.log('BUILD PAGE DETECTED');
diff --git a/src/Scheduler.ts b/src/Scheduler.ts
index 4c37e86..c6023a8 100644
--- a/src/Scheduler.ts
+++ b/src/Scheduler.ts
@@ -1,4 +1,4 @@
-import { sleepLong } from './utils';
+import { markPage, sleepLong, sleepShort } from './utils';
import { Queue, QueueItem } from './Queue';
import UpgradeBuildingTask from './Task/UpgradeBuildingTask';
import GoToBuildingAction from './Action/GoToBuildingAction';
@@ -17,6 +17,8 @@ export default class Scheduler {
}
async run() {
+ await sleepShort();
+ markPage('Executor');
while (true) {
await sleepLong();
const actionItem = this.popAction();
diff --git a/src/utils.ts b/src/utils.ts
index a93b75c..b18e964 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -3,8 +3,8 @@ export function sleep(ms: number) {
}
export async function sleepShort() {
- let ms = 2000 + Math.random() * 10000;
- console.log('SLEEp SHORT', Math.round(ms));
+ let ms = 2000 + Math.random() * 1000;
+ console.log('SLEEP SHORT', Math.round(ms));
return await sleep(ms);
}
@@ -13,3 +13,18 @@ export async function sleepLong() {
console.log('SLEEP LONG', Math.round(ms));
return await sleep(ms);
}
+
+export function markPage(text: string) {
+ jQuery('body').append(
+ '' +
+ text +
+ '
'
+ );
+}