Skip to content

Comments

[Enhance Performance with Optimizations and Caching] - Added Caching and Polling#107

Open
tulu-g559 wants to merge 1 commit intosristy17:dwoc-2025from
tulu-g559:Contribute
Open

[Enhance Performance with Optimizations and Caching] - Added Caching and Polling#107
tulu-g559 wants to merge 1 commit intosristy17:dwoc-2025from
tulu-g559:Contribute

Conversation

@tulu-g559
Copy link

Fixes Issue

#106

Changes proposed

  • Added caching to optimize data retrieval and improve performance.
  • Implemented polling mechanism to enhance responsiveness and reduce database load.

Check List (Check all the applicable boxes)

  • [ X] My code follows the code style of this project.
  • [X ] My change requires changes to the documentation.
  • [not ] I have updated the documentation accordingly.
  • [ X] All new and existing tests passed.
  • [ X] This PR does not contain plagiarized content.
  • [X ] The title of my pull request is a short description of the requested changes.

Screenshots

Note to reviewers

Please review the caching and polling mechanisms for any potential improvements or optimizations.

Copy link
Owner

@sristy17 sristy17 left a comment

Choose a reason for hiding this comment

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

Great job, @tulu-g559! 🎉 Thank you for submitting your pull request. Your contribution is valuable and we appreciate your efforts to improve our project.

We will promptly review your changes and offer feedback. Keep up the excellent work! Kindly remember to check our contributing guidelines

@tulu-g559
Copy link
Author

@sristy17
Pls check the PR

@sristy17 sristy17 requested a review from pooranjoyb February 26, 2025 14:41
@sristy17
Copy link
Owner

Fixes Issue

#106

Changes proposed

  • Added caching to optimize data retrieval and improve performance.
  • Implemented polling mechanism to enhance responsiveness and reduce database load.

Check List (Check all the applicable boxes)

  • [ X] My code follows the code style of this project.
  • [X ] My change requires changes to the documentation.
  • [not ] I have updated the documentation accordingly.
  • [ X] All new and existing tests passed.
  • [ X] This PR does not contain plagiarized content.
  • [X ] The title of my pull request is a short description of the requested changes.

Screenshots

Note to reviewers

Please review the caching and polling mechanisms for any potential improvements or optimizations.

app crashed??

Copy link
Collaborator

@pooranjoyb pooranjoyb left a comment

Choose a reason for hiding this comment

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

I see no point to implement caching in these two functionalities.
@sristy17 Anything to add?

import connectDatabase from './database/Mongo.database.js';
import sessions from 'express-session';

const express = require('express');
Copy link
Collaborator

Choose a reason for hiding this comment

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

The entire project is based on mjs architecture. Please update this.

headers: {
'Content-Type': 'application/json'
}
redisClient.setex(cacheKey, 3600, JSON.stringify(response.data.candidates[0].content.parts[0].text));
Copy link
Collaborator

Choose a reason for hiding this comment

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

SETEX is deprecated. Please upgrade.

contents: [
{
parts: [
const cacheKey = `mood_${scale}`;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I didn't get your point here. The sole purpose of caching is to reduce the api calls, not to cache whatever you want. Please understand the concepts before implementing something. Here, the mood is dynamic and it will fetch different responses based on different moods selected. Why is there a need to cache? @tulu-g559

contents: [
{
parts: [
const cacheKey = `tasks_${scale}`;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same thing here, no point to cache where responses are dynamic.
In situations where the data changes frequently or is user-specific, caching doesn't provide much benefit.
@tulu-g559

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.

3 participants