ftruncate(fd, 5 << 20); // FIXME
close(fd);
}
-
- // If the log file is stored in the cloud, we may need to fetch it
- if (clouddir >= 0 && start_fetch)
- cloudlog_fetch_start(map);
} else {
g_mutex_lock(map->lock);
}
+
+ /* If the log file is stored in the cloud and has not been fully fetched,
+ * we may need to initiate a fetch now. */
+ if (clouddir >= 0 && start_fetch && !map->complete && !map->fetching)
+ cloudlog_fetch_start(map);
+
g_mutex_unlock(log->mmap_lock);
if (map != NULL)
g_atomic_int_inc(&map->refcount);