Skip to content

Commit

Permalink
update rate limiter window to 5000
Browse files Browse the repository at this point in the history
  • Loading branch information
aialok committed Aug 25, 2024
1 parent e47d518 commit b27edff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion backend/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const limiter = rateLimit({
sendCommand: (...args) => redis.call(...args)
}),
windowMs: 15 * 60 * 1000, // 15 minutes
max: 100, // limiting each IP to 50 requests per windowMs
max: 2000, // limiting each IP to 50 requests per windowMs
standardHeaders: true,
legacyHeaders: false,
keyGenerator: (req) => {
Expand Down
4 changes: 4 additions & 0 deletions backend/src/services/flashcard.services.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ const redis = require("../config/redis.config");
class FlashcardServices {
// create a new Flashcard
async createFlashcard(data) {
// using transaction to make sure that both the pack and flashcard are created together
const t = await sequelize.transaction();
try {

/* Todo: update this to use bulk insert instead */

const [pack, created] = await Pack.findOrCreate({
where: { name: data.packName.trim() },
defaults: { name: data.packName.trim() },
Expand Down

0 comments on commit b27edff

Please sign in to comment.