Skip to content

Commit

Permalink
List orphaned users lost from queue in dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
cpfair committed Oct 25, 2014
1 parent bce9101 commit b80ab85
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tapiriik/web/templates/diag/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,30 @@ <h3>Sync</h3>
{% endif %}
<form action="{% url 'diagnostics_dashboard' %}" method="POST">{% csrf_token %}<input type="submit" name="unlockOrphaned" value="Unlock orphaned"></form>
</li>
<li><b>Queued but unlocked records:</b>
<table>
<tr>
<th>Worker</th>
<th>Host</th>
<th>User</th>
<th>ID</th>
<th>Prog</th>
<th>State</th>
</tr>
{% for unlockedUser in queuedUnlockedUsers %}
{% with userId=unlockedUser|dict_get:'_id' %}
<tr>
<td>{{ unlockedUser.SynchronizationWorker }}</td>
<td>{{ unlockedUser.SynchronizationHost }}</td>
<td><a href="{% url 'diagnostics_user' user=userId %}">{{ userId|slice:":7" }}</a></td>
<td>{{ userId }}</td>
<td>{{ unlockedUser.SynchronizationProgress|percentage }}</td>
<td>{% if unlockedUser.SynchronizationWorker not in allWorkerPIDs and unlockedUser.SynchronizationWorker not in allWorkerPIDsPre %} <span style="color:red">(orphaned)</span>{% endif %}{% if unlockedUser.SynchronizationWorker in stalledWorkerPIDs %} <span style="color:orange;">(stalled)</span>{% endif %}</td>
</tr>
{% endwith %}
{% endfor %}
</table>
</li>
</ul>
</div>

Expand Down
1 change: 1 addition & 0 deletions tapiriik/web/views/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def diag_dashboard(req):

context["lockedSyncUsers"] = list(db.users.find({"SynchronizationWorker": {"$ne": None}}))
context["lockedSyncRecords"] = len(context["lockedSyncUsers"])
context["queuedUnlockedUsers"] = list(db.users.find({"SynchronizationWorker": {"$ne": None}, "QueuedAt": {"$ne": None}}))

context["pendingSynchronizations"] = db.users.find({"NextSynchronization": {"$lt": datetime.utcnow()}}).count()
context["pendingSynchronizationsLocked"] = db.users.find({"NextSynchronization": {"$lt": datetime.utcnow()}, "SynchronizationWorker": {"$ne": None}}).count()
Expand Down

0 comments on commit b80ab85

Please sign in to comment.