Skip to content

Commit

Permalink
Remove bookmark upgrade and also run housekeeping immediately
Browse files Browse the repository at this point in the history
  • Loading branch information
oeway committed Dec 18, 2024
1 parent 0237b8f commit fe3bc89
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 33 deletions.
2 changes: 1 addition & 1 deletion hypha/VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "0.20.44.post1"
"version": "0.20.44.post2"
}
32 changes: 0 additions & 32 deletions hypha/core/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ def __init__(
sources=[self._source],
)
self._house_keeping_schedule = None
self._first_run = True

self._redis_cache = RedisCache(serializer=PickleSerializer())
self._redis_cache.client = self._redis
Expand Down Expand Up @@ -304,10 +303,6 @@ async def _run_startup_functions(self, startup_functions):

async def housekeeping(self):
"""Perform housekeeping tasks."""
if self._first_run:
logger.info("Skipping housekeeping on first run")
self._first_run = False
return
try:
logger.info(f"Running housekeeping task at {datetime.datetime.now()}")
async with self.get_workspace_interface(
Expand Down Expand Up @@ -388,32 +383,6 @@ async def upgrade(self):
}
)

workspaces = await self.get_all_workspace()
logger.info("Upgrading workspace bookmarks for version < 0.20.34")
for workspace in workspaces:
workspace.config["bookmarks"] = workspace.config.get("bookmarks") or []
for bookmark in workspace.config["bookmarks"]:
if "type" in bookmark:
bookmark_type = bookmark["type"]
if not bookmark_type:
continue
logger.info(
f"Convert bookmark type: {bookmark}, workspace: {workspace.id}"
)
bookmark["bookmark_type"] = bookmark_type
del bookmark["type"]

# Log the change
change_time = datetime.datetime.now().isoformat()
database_change_log.append(
{
"time": change_time,
"version": __version__,
"change": f"Converted bookmark type in workspace {workspace.id}",
}
)
await self.set_workspace(workspace, self._root_user, overwrite=True)

await self._redis.set("hypha_version", __version__)

# Record the end of the upgrade process
Expand Down Expand Up @@ -563,7 +532,6 @@ async def init(self, reset_redis, startup_functions=None):
self._house_keeping_schedule = await self.schedule_task(
self.housekeeping, task_name="housekeeping", corn="*/1 * * * *"
)
self._first_run = True

async def schedule_task(
self,
Expand Down

0 comments on commit fe3bc89

Please sign in to comment.