Skip to content

Commit

Permalink
Added a counter for missed spawnpoints. Thanks Arengo for the idea!
Browse files Browse the repository at this point in the history
  • Loading branch information
neskk committed Dec 1, 2017
1 parent d1d672c commit 7f9e2c1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
7 changes: 6 additions & 1 deletion pogom/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,7 @@ class WorkerStatus(LatLongModel):
fail = IntegerField()
no_items = IntegerField()
skip = IntegerField()
missed = IntegerField()
captcha = IntegerField()
last_modified = DateTimeField(index=True)
message = Utf8mb4CharField(max_length=191)
Expand All @@ -1116,6 +1117,7 @@ def db_format(status, name='status_worker_db'):
'fail': status['fail'],
'no_items': status['noitems'],
'skip': status['skip'],
'missed': status['missed'],
'captcha': status['captcha'],
'last_modified': datetime.utcnow(),
'message': status['message'],
Expand Down Expand Up @@ -2293,6 +2295,7 @@ def parse_map(args, map_dict, step_location, db_update_queue, wh_update_queue,
if clock_between(endpoints[0], now_secs, endpoints[1]):
sp['missed_count'] += 1
spawn_points[sp['id']] = sp
status['missed'] += 1
log.warning('%s kind spawnpoint %s has no Pokemon %d times'
' in a row.',
sp['kind'], sp['id'], sp['missed_count'])
Expand Down Expand Up @@ -3066,7 +3069,9 @@ def database_migrate(db, old_ver):
DateTimeField(
null=False, default=datetime.utcnow())),
migrator.add_column('gym', 'total_cp',
SmallIntegerField(null=False, default=0)))
SmallIntegerField(null=False, default=0)),
migrator.add_column('workerstatus', 'missed',
IntegerField(null=True)))

# Always log that we're done.
log.info('Schema upgrade complete.')
13 changes: 9 additions & 4 deletions pogom/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,15 @@ def status_printer(threadStatus, account_failures, logmode, hash_key,
str(threadStatus[item]['proxy_display'])))

# How pretty.
status = '{:10} | {:5} | {:' + str(userlen) + '} | {:' + str(
proxylen) + '} | {:7} | {:6} | {:5} | {:7} | {:8} | {:10}'
status = ('{:10} | {:5} | {:' + str(userlen) + '} | {:' + str(
proxylen) + '} | {:7} | {:6} | {:5} | {:7} | {:6} | {:8} ' +
'| {:10}')

# Print the worker status.
status_text.append(status.format('Worker ID', 'Start', 'User',
'Proxy', 'Success', 'Failed',
'Empty', 'Skipped', 'Captchas',
'Message'))
'Empty', 'Skipped', 'Missed',
'Captchas', 'Message'))
for item in sorted(threadStatus):
if(threadStatus[item]['type'] == 'Worker'):
current_line += 1
Expand All @@ -202,6 +203,7 @@ def status_printer(threadStatus, account_failures, logmode, hash_key,
threadStatus[item]['fail'],
threadStatus[item]['noitems'],
threadStatus[item]['skip'],
threadStatus[item]['missed'],
threadStatus[item]['captcha'],
threadStatus[item]['message']))

Expand Down Expand Up @@ -451,6 +453,7 @@ def search_overseer_thread(args, new_location_queue, control_flags, heartb,
'fail': 0,
'noitems': 0,
'skip': 0,
'missed': 0,
'captcha': 0,
'username': '',
'proxy_display': proxy_display,
Expand Down Expand Up @@ -811,6 +814,8 @@ def search_worker_thread(args, account_queue, account_sets, account_failures,
0,
'skip':
0,
'missed':
0,
'captcha':
0,
'active':
Expand Down
5 changes: 5 additions & 0 deletions static/js/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ function addWorker(mainWorkerHash, workerHash) {
<div id="fail_${workerHash}" class="status_cell"/>
<div id="no_items_${workerHash}" class="status_cell"/>
<div id="skip_${workerHash}" class="status_cell"/>
<div id="missed_${workerHash}" class="status_cell"/>
<div id="captchas_${workerHash}" class="status_cell"/>
<div id="lastmod_${workerHash}" class="status_cell"/>
<div id="message_${workerHash}" class="status_cell"/>
Expand Down Expand Up @@ -101,6 +102,7 @@ function processWorker(i, worker) {
$('#fail_' + hash).html(worker['fail'])
$('#no_items_' + hash).html(worker['no_items'])
$('#skip_' + hash).html(worker['skip'])
$('#missed_' + hash).html(worker['missed'])
$('#captchas_' + hash).html(worker['captcha'])
$('#lastmod_' + hash).html(lastModified)
$('#message_' + hash).html(worker['message'])
Expand Down Expand Up @@ -237,6 +239,9 @@ function addTable(hash) {
<div class="status_cell">
Skipped
</div>
<div class="status_cell">
Missed
</div>
<div class="status_cell">
Captchas
</div>
Expand Down

0 comments on commit 7f9e2c1

Please sign in to comment.