Mycroft skills polling config server every minute

Summary

Mycroft skills appear to be pulling static config data every minute from https://api.mycroft.ai which is wasting bandwidth and could be placing servers under unnecessary load.
Even skills which are installed but inactive, and not configured log comms.

Environment

  • Mark One
  • mycroft-core 0.9.18
  • msm update skills on 2018-02-28 (can’t see how to check skill versions)

Steps to reproduce

  • Update Mark One
  • Do nothing
  • Watch the logs (to name but one example):
    tail -f /var/log/mycroft-skills.log
    grep -i PianobarSkill /var/log/mycroft-skills.log
  • Unconfigured and unused skills poll every minute.

Desired behaviour

  • Mycroft uses network bandwidth and server CPU efficiently
  • Skills only poll to update static config as required - weather could be (say) 60 minutes, unconfigured default-install skills don’t individually poll frequently at all but rely on a single system process to signal specific skills with changes to update?

Detail

After having to manually recover from a failed automatic core software update (around v0.9.5 - several reboots needed but firmware updates arived with good display graphics), I updated my Mark 1 and whilst debugging another skill, noticed a lot of very frequent skill DEBUG messages suggesting repeated downloading of config from the mycroft.ai server.

Default install skills polling every minute include:

DEBUG - getting skill settings from server for TimeSkill
DEBUG - getting skill settings from server for SkillInstallerSkill
DEBUG - getting skill settings from server for Mark1
DEBUG - getting skill settings from server for WeatherSkill
DEBUG - getting skill settings from server for PianobarSkill
DEBUG - getting skill settings from server for SpotifySkill

After some digging, two skills are clients for music services I don’t use and have never configured (SpotifySkill = Spotify, PianobarSkill = Pandora).

I can see a case for config changes made via the Mycroft web portal to be acted on fairly quickly, so perhaps Mark1 or SkillInstallerSkill needs to poll more frequently, but if user expectations are set, is every 60 seconds still too frequent?

I’ve not fired up WireShark / pcap on a span port to check the wire comms and bandwidth used, however the logs seem pretty explicit that each request is a server round-trip burning both bandwidth and server CPU:

13:08:54.292 - mycroft.skills.settings:_request_my_settings:433 - DEBUG - getting skill settings from server for SpotifySkill
13:08:54.296 - requests.packages.urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): api.mycroft.ai
13:08:58.842 - requests.packages.urllib3.connectionpool - DEBUG - https://api.mycroft.ai:443 "GET /v1/device/9b3a9118-fcea-4c24-81d9-ab4254421bbc/skill HTTP/1.1" 200 7171

A workaround may well be msm remove PianobarSkill SpotifySkill, but if these are default installs on Mark 1 (and later Mark 2?), that could be a lot of server CPU minutes wasted.

This is a superb fault description, much appreciated.
Flagging @forslund and @steve.penrod so they’re aware.

Might be able to save additional bandwidth by simply having it ask “Have any skill settings changed?” If no, it’s reduced it to a single small query/response, and they’ll all still be checked as often as the most frequently checked skill. If yes, the server could also include a list of which ones, and Mycroft would only need to update the ones on the list.