Commit 44ed4f1
authored
perf(github): Reduce GitHub API cache size by storing only required response fields (JhaSourav07#2076)
## Description
### What does this PR do?
This PR optimizes GitHub API response caching by storing only the fields
required by the application instead of caching the entire GitHub REST
API response.
### Changes Made
* Added `sanitizeUserProfile()` to retain only the required profile
fields.
* Added `sanitizeRepo()` to retain only the repository fields used by
the application.
* Updated `fetchUserProfile()` to sanitize profile data before caching
and returning it.
* Updated `fetchUserRepos()` to sanitize repository data before caching
and returning it.
* Added unit tests to verify that unnecessary fields are stripped before
caching.
### Benefits
* Reduces cache memory footprint.
* Decreases cache storage requirements.
* Improves cache efficiency while preserving existing functionality.
* Prevents unnecessary GitHub API payload data from being stored.
### Testing
* Added sanitization tests for profile responses.
* Added sanitization tests for repository responses.
* Verified ESLint passes successfully.
* Verified all related tests pass locally.
* Confirmed all project tests pass after the change.
### Issue Fixed
Closes JhaSourav07#1856
---
## Pillar
🚀 Performance Optimization
---
## Checklist
* [x] I have linked the correct issue.
* [x] My code follows the project's coding standards.
* [x] I have tested my changes locally.
* [x] ESLint passes successfully.
* [x] Existing functionality remains unaffected.
* [x] Added/updated tests where applicable.
* [x] This PR is focused on a single issue and does not include
unrelated changes.2 files changed
Lines changed: 90 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
522 | 522 | | |
523 | 523 | | |
524 | 524 | | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
525 | 551 | | |
526 | 552 | | |
527 | 553 | | |
| |||
568 | 594 | | |
569 | 595 | | |
570 | 596 | | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
571 | 620 | | |
572 | 621 | | |
573 | 622 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
278 | 313 | | |
279 | 314 | | |
280 | 315 | | |
| |||
583 | 618 | | |
584 | 619 | | |
585 | 620 | | |
586 | | - | |
587 | | - | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
588 | 624 | | |
589 | 625 | | |
590 | 626 | | |
| |||
622 | 658 | | |
623 | 659 | | |
624 | 660 | | |
625 | | - | |
| 661 | + | |
626 | 662 | | |
627 | 663 | | |
628 | 664 | | |
| |||
649 | 685 | | |
650 | 686 | | |
651 | 687 | | |
652 | | - | |
| 688 | + | |
| 689 | + | |
653 | 690 | | |
654 | 691 | | |
655 | 692 | | |
| |||
0 commit comments