public function cron() {
        $fs = get_file_storage();
        $files = $fs->get_external_files($this->id);
        $fetchedreferences = [];
        foreach ($files as $file) {
            if (isset($fetchedreferences[$file->get_referencefileid()])) {
                continue;
            }
            try {
                // This call will cache all files that are smaller than max_cache_bytes()
                // and synchronise file size of all others.
                $this->import_external_file_contents($file, $this->max_cache_bytes());
                $fetchedreferences[$file->get_referencefileid()] = true;
            } catch (moodle_exception $e) {
                // If an exception is thrown, just continue. This is only a pre-fetch to help speed up general use.
            }
        }
    }