{ "issue": { "url": "https://api.github.com/repos/laurent22/joplin/issues/9988", "repository_url": "https://api.github.com/repos/laurent22/joplin", "labels_url": "https://api.github.com/repos/laurent22/joplin/issues/9988/labels{/name}", "comments_url": "https://api.github.com/repos/laurent22/joplin/issues/9988/comments", "events_url": "https://api.github.com/repos/laurent22/joplin/issues/9988/events", "html_url": "https://github.com/laurent22/joplin/pull/9988", "id": 2151745946, "node_id": "PR_kwDOBLftOs5nyn2_", "number": 9988, "title": "Server: Fixes #9931: Add task to delete events older than a week", "user": { "login": "tecc", "id": 38840234, "node_id": "MDQ6VXNlcjM4ODQwMjM0", "avatar_url": "https://avatars.githubusercontent.com/u/38840234?v=4", "gravatar_id": "", "url": "https://api.github.com/users/tecc", "html_url": "https://github.com/tecc", "followers_url": "https://api.github.com/users/tecc/followers", "following_url": "https://api.github.com/users/tecc/following{/other_user}", "gists_url": "https://api.github.com/users/tecc/gists{/gist_id}", "starred_url": "https://api.github.com/users/tecc/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/tecc/subscriptions", "organizations_url": "https://api.github.com/users/tecc/orgs", "repos_url": "https://api.github.com/users/tecc/repos", "events_url": "https://api.github.com/users/tecc/events{/privacy}", "received_events_url": "https://api.github.com/users/tecc/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "labels": [], "state": "closed", "locked": false, "assignee": null, "assignees": [], "milestone": null, "comments": 5, "created_at": "2024-02-23T20:25:21Z", "updated_at": "2024-04-09T07:21:09Z", "closed_at": "2024-03-09T10:50:56Z", "author_association": "NONE", "sub_issues_summary": { "total": 0, "completed": 0, "percent_completed": 0 }, "active_lock_reason": null, "draft": false, "pull_request": { "url": "https://api.github.com/repos/laurent22/joplin/pulls/9988", "html_url": "https://github.com/laurent22/joplin/pull/9988", "diff_url": "https://github.com/laurent22/joplin/pull/9988.diff", "patch_url": "https://github.com/laurent22/joplin/pull/9988.patch", "merged_at": null }, "body": "\r\nThis fixes #9931 through adding a task that deletes any tasks older than a week.\r\n\r\nThe task in question looks like this:\r\n```ts\r\npublic async deleteOldEvents(beforeMillis: number = Date.now() - Week) {\r\n\treturn this.withTransaction(async () => {\r\n\t\tawait this.db(this.tableName)\r\n\t\t\t.where('created_time', '<', beforeMillis)\r\n\t\t\t.delete();\r\n\t}, 'EventModel::deleteOldEvents');\r\n}\r\n```\r\n", "closed_by": { "login": "laurent22", "id": 1285584, "node_id": "MDQ6VXNlcjEyODU1ODQ=", "avatar_url": "https://avatars.githubusercontent.com/u/1285584?v=4", "gravatar_id": "", "url": "https://api.github.com/users/laurent22", "html_url": "https://github.com/laurent22", "followers_url": "https://api.github.com/users/laurent22/followers", "following_url": "https://api.github.com/users/laurent22/following{/other_user}", "gists_url": "https://api.github.com/users/laurent22/gists{/gist_id}", "starred_url": "https://api.github.com/users/laurent22/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/laurent22/subscriptions", "organizations_url": "https://api.github.com/users/laurent22/orgs", "repos_url": "https://api.github.com/users/laurent22/repos", "events_url": "https://api.github.com/users/laurent22/events{/privacy}", "received_events_url": "https://api.github.com/users/laurent22/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/9988/reactions", "total_count": 1, "+1": 1, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "timeline_url": "https://api.github.com/repos/laurent22/joplin/issues/9988/timeline", "performed_via_github_app": null, "state_reason": null }, "comments": [ { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1961944482", "html_url": "https://github.com/laurent22/joplin/pull/9988#issuecomment-1961944482", "issue_url": "https://api.github.com/repos/laurent22/joplin/issues/9988", "id": 1961944482, "node_id": "IC_kwDOBLftOs508OWi", "user": { "login": "github-actions[bot]", "id": 41898282, "node_id": "MDM6Qm90NDE4OTgyODI=", "avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4", "gravatar_id": "", "url": "https://api.github.com/users/github-actions%5Bbot%5D", "html_url": "https://github.com/apps/github-actions", "followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers", "following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}", "gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}", "starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions", "organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs", "repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos", "events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}", "received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events", "type": "Bot", "user_view_type": "public", "site_admin": false }, "created_at": "2024-02-23T20:25:37Z", "updated_at": "2024-03-09T10:51:09Z", "author_association": "CONTRIBUTOR", "body": "****CLA Assistant Lite bot**** All contributors have signed the CLA ✍️ ✅", "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1961944482/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "performed_via_github_app": { "id": 15368, "client_id": "Iv1.05c79e9ad1f6bdfa", "slug": "github-actions", "node_id": "MDM6QXBwMTUzNjg=", "owner": { "login": "github", "id": 9919, "node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=", "avatar_url": "https://avatars.githubusercontent.com/u/9919?v=4", "gravatar_id": "", "url": "https://api.github.com/users/github", "html_url": "https://github.com/github", "followers_url": "https://api.github.com/users/github/followers", "following_url": "https://api.github.com/users/github/following{/other_user}", "gists_url": "https://api.github.com/users/github/gists{/gist_id}", "starred_url": "https://api.github.com/users/github/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/github/subscriptions", "organizations_url": "https://api.github.com/users/github/orgs", "repos_url": "https://api.github.com/users/github/repos", "events_url": "https://api.github.com/users/github/events{/privacy}", "received_events_url": "https://api.github.com/users/github/received_events", "type": "Organization", "user_view_type": "public", "site_admin": false }, "name": "GitHub Actions", "description": "Automate your workflow from idea to production", "external_url": "https://help.github.com/en/actions", "html_url": "https://github.com/apps/github-actions", "created_at": "2018-07-30T09:30:17Z", "updated_at": "2025-03-07T16:35:00Z", "permissions": { "actions": "write", "administration": "read", "attestations": "write", "checks": "write", "contents": "write", "deployments": "write", "discussions": "write", "issues": "write", "merge_queues": "write", "metadata": "read", "models": "read", "packages": "write", "pages": "write", "pull_requests": "write", "repository_hooks": "write", "repository_projects": "write", "security_events": "write", "statuses": "write", "vulnerability_alerts": "read" }, "events": [ "branch_protection_rule", "check_run", "check_suite", "create", "delete", "deployment", "deployment_status", "discussion", "discussion_comment", "fork", "gollum", "issues", "issue_comment", "label", "merge_group", "milestone", "page_build", "project", "project_card", "project_column", "public", "pull_request", "pull_request_review", "pull_request_review_comment", "push", "registry_package", "release", "repository", "repository_dispatch", "status", "watch", "workflow_dispatch", "workflow_run" ] } }, { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1962042832", "html_url": "https://github.com/laurent22/joplin/pull/9988#issuecomment-1962042832", "issue_url": "https://api.github.com/repos/laurent22/joplin/issues/9988", "id": 1962042832, "node_id": "IC_kwDOBLftOs508mXQ", "user": { "login": "tecc", "id": 38840234, "node_id": "MDQ6VXNlcjM4ODQwMjM0", "avatar_url": "https://avatars.githubusercontent.com/u/38840234?v=4", "gravatar_id": "", "url": "https://api.github.com/users/tecc", "html_url": "https://github.com/tecc", "followers_url": "https://api.github.com/users/tecc/followers", "following_url": "https://api.github.com/users/tecc/following{/other_user}", "gists_url": "https://api.github.com/users/tecc/gists{/gist_id}", "starred_url": "https://api.github.com/users/tecc/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/tecc/subscriptions", "organizations_url": "https://api.github.com/users/tecc/orgs", "repos_url": "https://api.github.com/users/tecc/repos", "events_url": "https://api.github.com/users/tecc/events{/privacy}", "received_events_url": "https://api.github.com/users/tecc/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "created_at": "2024-02-23T21:45:39Z", "updated_at": "2024-02-23T21:45:39Z", "author_association": "NONE", "body": "I have read the CLA Document and I hereby sign the CLA", "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1962042832/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "performed_via_github_app": null }, { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1962398307", "html_url": "https://github.com/laurent22/joplin/pull/9988#issuecomment-1962398307", "issue_url": "https://api.github.com/repos/laurent22/joplin/issues/9988", "id": 1962398307, "node_id": "IC_kwDOBLftOs5099Jj", "user": { "login": "tecc", "id": 38840234, "node_id": "MDQ6VXNlcjM4ODQwMjM0", "avatar_url": "https://avatars.githubusercontent.com/u/38840234?v=4", "gravatar_id": "", "url": "https://api.github.com/users/tecc", "html_url": "https://github.com/tecc", "followers_url": "https://api.github.com/users/tecc/followers", "following_url": "https://api.github.com/users/tecc/following{/other_user}", "gists_url": "https://api.github.com/users/tecc/gists{/gist_id}", "starred_url": "https://api.github.com/users/tecc/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/tecc/subscriptions", "organizations_url": "https://api.github.com/users/tecc/orgs", "repos_url": "https://api.github.com/users/tecc/repos", "events_url": "https://api.github.com/users/tecc/events{/privacy}", "received_events_url": "https://api.github.com/users/tecc/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "created_at": "2024-02-24T15:15:07Z", "updated_at": "2024-02-24T15:15:07Z", "author_association": "NONE", "body": "Added a test for it, although as a side effect I felt it necessary to make `created_time` a parameter.\r\nMaking `created_time` a parameter makes it easier to control the timestamps of the events rather than haphazardly guessing them. The parameter could be used in the `should get the latest event` test as well to speed it up ever so slightly.", "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1962398307/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "performed_via_github_app": null }, { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1986823204", "html_url": "https://github.com/laurent22/joplin/pull/9988#issuecomment-1986823204", "issue_url": "https://api.github.com/repos/laurent22/joplin/issues/9988", "id": 1986823204, "node_id": "IC_kwDOBLftOs52bIQk", "user": { "login": "laurent22", "id": 1285584, "node_id": "MDQ6VXNlcjEyODU1ODQ=", "avatar_url": "https://avatars.githubusercontent.com/u/1285584?v=4", "gravatar_id": "", "url": "https://api.github.com/users/laurent22", "html_url": "https://github.com/laurent22", "followers_url": "https://api.github.com/users/laurent22/followers", "following_url": "https://api.github.com/users/laurent22/following{/other_user}", "gists_url": "https://api.github.com/users/laurent22/gists{/gist_id}", "starred_url": "https://api.github.com/users/laurent22/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/laurent22/subscriptions", "organizations_url": "https://api.github.com/users/laurent22/orgs", "repos_url": "https://api.github.com/users/laurent22/repos", "events_url": "https://api.github.com/users/laurent22/events{/privacy}", "received_events_url": "https://api.github.com/users/laurent22/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "created_at": "2024-03-09T10:50:54Z", "updated_at": "2024-03-09T10:50:54Z", "author_association": "OWNER", "body": "@tecc, sorry I need to close this pull request since we're trying to keep the list of PR current. However if you would like to complete the pull request please let me know and I'll reopen.", "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1986823204/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "performed_via_github_app": null }, { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/2044306903", "html_url": "https://github.com/laurent22/joplin/pull/9988#issuecomment-2044306903", "issue_url": "https://api.github.com/repos/laurent22/joplin/issues/9988", "id": 2044306903, "node_id": "IC_kwDOBLftOs552aXX", "user": { "login": "rainforest1155", "id": 4227209, "node_id": "MDQ6VXNlcjQyMjcyMDk=", "avatar_url": "https://avatars.githubusercontent.com/u/4227209?v=4", "gravatar_id": "", "url": "https://api.github.com/users/rainforest1155", "html_url": "https://github.com/rainforest1155", "followers_url": "https://api.github.com/users/rainforest1155/followers", "following_url": "https://api.github.com/users/rainforest1155/following{/other_user}", "gists_url": "https://api.github.com/users/rainforest1155/gists{/gist_id}", "starred_url": "https://api.github.com/users/rainforest1155/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/rainforest1155/subscriptions", "organizations_url": "https://api.github.com/users/rainforest1155/orgs", "repos_url": "https://api.github.com/users/rainforest1155/repos", "events_url": "https://api.github.com/users/rainforest1155/events{/privacy}", "received_events_url": "https://api.github.com/users/rainforest1155/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "created_at": "2024-04-09T07:21:07Z", "updated_at": "2024-04-09T07:21:07Z", "author_association": "NONE", "body": "@tecc Thank you for your work on this so far! I was wondering if you think you would be able to work on this again in the near future? I have about 210MB of data on my Joplin server right now, but the database dump amounts to almost 1000MB, which with my daily backup strategy does add up quite a bit. So I would love to have a clean up task in place as you proposed.\r\nThanks!", "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/2044306903/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "performed_via_github_app": null } ] }