Skip to content

Conversation

@guimard
Copy link
Member

@guimard guimard commented Oct 21, 2025

Summary

  • Replace sequential getPropertiesForMultiplePaths calls with batch fetching using getMultipleCalendarObjects
  • Reduces REPORT request time significantly by executing a single MongoDB query with $in instead of N sequential queries

Changes

  • Modified getMultipleDAVItems() in lib/JSON/Plugin.php to use getMultipleCalendarObjects() when available
  • Falls back to getPropertiesForMultiplePaths for nodes without batch support (e.g., SharedCalendar)
  • Added healthcheck dependency to docker-compose.test.yaml for MongoDB and RabbitMQ to prevent test failures

Performance Impact

Before: N sequential MongoDB queries (one per calendar object)
After: 1 batch MongoDB query with $in operator

For an agenda with 100 events in a time range, this reduces from 100 queries to 1 query.

Test plan

  • All 406 PHPUnit tests passed
  • PHP syntax validation passed
  • Verified fallback works for SharedCalendar nodes

Fixes #129

🤖 Generated with Claude Code

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR optimizes REPORT request performance by replacing sequential MongoDB queries with batch fetching. The main optimization leverages getMultipleCalendarObjects() to execute a single query with $in operator instead of N sequential queries when fetching calendar objects, with fallback support for nodes that don't implement batch fetching.

Key Changes:

  • Implements batch fetching in getMultipleDAVItems() using getMultipleCalendarObjects() when available
  • Adds fallback to sequential getPropertiesForMultiplePaths for nodes without batch support
  • Updates Docker Compose test configuration to add health checks for MongoDB and RabbitMQ

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
lib/JSON/Plugin.php Adds batch fetching logic with getMultipleCalendarObjects() and maintains fallback to sequential queries
docker-compose.test.yaml Adds health check conditions to prevent test failures from unready dependencies

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Member

@chibenwa chibenwa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While the optimization looks like a decent idea it is overall detrimental.

Image

(50% slower)

We did also not address the core issue: esn-sabre CPU consumption on sabre DAV due to parsing of significant amount of events.

@chibenwa chibenwa marked this pull request as draft October 21, 2025 14:18
guimard and others added 2 commits October 23, 2025 09:45
Replace sequential getPropertiesForMultiplePaths calls with batch fetching using getMultipleCalendarObjects. This reduces REPORT request time significantly by executing a single MongoDB query with $in instead of N sequential queries.

Changes:
- Modified getMultipleDAVItems to use getMultipleCalendarObjects when available
- Falls back to getPropertiesForMultiplePaths for nodes without batch support
- Added healthcheck dependency to docker-compose.test.yaml for MongoDB and RabbitMQ

Fixes #129

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@guimard guimard force-pushed the 129-optimize-report-performance branch from 8a0cca1 to bad5ac7 Compare October 23, 2025 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

REPORTs on massive agenda is slow

2 participants