closeio / closeio/sync-engine

Optimize deleting large calendars

Open
#50 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
30
Forks
13
Avg merge
1d 2h
Merged PRs (30d)
8

Description

https://github.com/closeio/sync-engine/blob/16cbcc1dbe4e5aa5ffad1d7f6f49d5c915f1c81c/inbox/events/remote_sync.py#L396-L419 is fetching all the calendar data, which is inefficient and causes timeouts.

We should use DELETE with a LIMIT until there are no events (~1s for a batch size of 1K, ~4s for a batch size of 10K).

DELETE FROM event WHERE calendar_id=XXXX LIMIT 1000;

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at inbox/events/remote_sync.py lines 396-419 and inspect how calendar events are currently fetched and deleted. Replace the large-calendar path with repeated limited DELETE operations, using the proposed batch size as a starting point. Done means deletion no longer fetches all calendar data and completes without the reported timeouts.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sql
Domain
database
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.