Skip to content

Commit

Permalink
Merge pull request #39 from fabricadesoftware-ifc/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
jonatasperaza authored Nov 21, 2024
2 parents 2ec1b87 + 46efede commit ecd55d3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const { logs } = require("./routes/logs");
const { health } = require("./routes/health");

const limiter = RateLimit({
windowMs: 15 * 60 * 1000, // 15 minutes
max: 150, // max 150 requests per windowMs
windowMs: 5 * 60 * 1000, // 15 minutes
max: 250, // max 150 requests per windowMs
});

app.use("/auth", auth);
Expand Down
3 changes: 0 additions & 3 deletions src/routes/Logs/logs/logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ router.post("/", async (req, res) => {
if (message !== String){
message = JSON.stringify(message)
}
// Enviar a resposta imediatamente
res.status(200).json({ success: true, message: "Log is being processed" });

// Processar a criação do log e emitir evento de forma assíncrona
try {
const log = await prisma.logs.create({
data: {
Expand All @@ -41,7 +39,6 @@ router.post("/", async (req, res) => {
},
});

// Emitir evento WebSocket após salvar no banco
io.io.emit("logs", { data: log });
} catch (error) {
console.error("Erro ao processar log:", error.message);
Expand Down

0 comments on commit ecd55d3

Please sign in to comment.