Performance: Implement parallel assignment fetching in AppScript classroom snapshot exporter

Resolved 💬 3 comments Opened Aug 15, 2025 by armorup Closed Jan 5, 2026

Problem

The AppScript classroom snapshot exporter is running slowly due to sequential assignment fetching with rate limiting delays.

Current Performance Issues

  • Assignment fetching uses sequential processing (one-by-one with delays)
  • Each assignment takes ~1-2 seconds to fetch
  • Rate limiting delays compound the total export time
  • Only submission collection has parallel processing, not assignment fetching

Impact

  • Slow exports for teachers with classrooms containing many assignments
  • Poor user experience during data export
  • Timeouts possible for very large classrooms

Proposed Solution

1. Create Parallel Assignment Fetching

// New function in DataCollectors.js
collectAssignmentsParallel: function(courseId, config = {}) {
  // Use UrlFetchApp.fetchAll() for batched parallel requests
  // Process assignments in batches of 5-10 to avoid rate limiting
  // Implement adaptive rate limiting between batches
}

2. Update Export Logic

// In ClassroomSnapshotExporter.js
enrichClassroomWithData: function(classroom, config, teacherEmail) {
  // Detect classrooms with many assignments (>10)
  // Switch to parallel processing when beneficial
  // Fall back to sequential for smaller classrooms
}

3. Performance Optimization

  • Current: ~1-2 seconds per assignment (sequential)
  • Target: ~5-10 assignments in parallel batches
  • Expected: 5-10x faster for classrooms with many assignments

Files to Modify

  1. appscript/development/classroom-snapshot-exporter/DataCollectors.js
  • Add collectAssignmentsParallel() function
  • Implement batched parallel requests using UrlFetchApp.fetchAll()
  1. appscript/development/classroom-snapshot-exporter/ClassroomSnapshotExporter.js
  • Update enrichClassroomWithData() to use parallel assignment fetching
  • Add logic to detect when parallel processing is beneficial

Technical Requirements

  • Maintain API rate limit compliance
  • Preserve existing error handling and retry logic
  • Keep adaptive rate limiting between batches
  • Ensure backward compatibility with current export format

Success Criteria

  • [ ] Parallel assignment fetching implemented
  • [ ] Export time reduced by 5-10x for classrooms with >10 assignments
  • [ ] No increase in API rate limit violations
  • [ ] Existing functionality preserved
  • [ ] Updated AppScript deployed to production

Priority

Medium - Performance enhancement that significantly improves user experience for teachers with large classrooms.

---

Labels: performance, enhancement, appscript, google-classroom-api

Related to teacherEmail implementation work in recent commits.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗