code: def sync_config_tasks(self):
          
  
          tasks_by_hash = {_hash_task(t): t for t in self.config_tasks}
  
          for task in self.all_tasks:
              if tasks_by_hash.get(task["hash"]):
                  del tasks_by_hash[task["hash"]]
              else:
                  self.collection.remove({"_id": task["_id"]})
                  log.debug("Scheduler: deleted %s" % task["hash"])
  
          # What remains are the new ones to be inserted
          for h, task in tasks_by_hash.items():
              task["hash"] = h
              task["datelastqueued"] = datetime.datetime.fromtimestamp(0)
              if task.get("dailytime"):
                  # Because MongoDB can store datetimes but not times,
                  # we add today's date to the dailytime.
                  # The date part will be discarded in check()
                  task["dailytime"] = datetime.datetime.combine(
                      datetime.datetime.utcnow(), task["dailytime"])
                  task["interval"] = 3600 * 24
  
                  # Avoid to queue task in check() if today dailytime is already passed
                  if datetime.datetime.utcnow().time() > task["dailytime"].time():
                      task["datelastqueued"] = datetime.datetime.utcnow()
  
              self.collection.find_one_and_update({"hash": task["hash"]}, {"$set": task}, upsert=True)
              log.debug("Scheduler: added %s" % task["hash"])
docs: Performs the first sync of a list of tasks, often defined in the config file.