Skip to content

Commit b46286b

Browse files
matheusmartinsInspermatheusmartinsInsper
authored andcommitted
fix: added cache to identify duplicated messages on events
- Update Docker image repository to evoapicloud/evolution-api - Modify contact email to [email protected] - Update Docker Compose, Dockerfile, and workflow files - Add Docker image badge to README - Include additional content creator in README - Implement message deduplication cache in Baileys service
1 parent f2d7823 commit b46286b

File tree

10 files changed

+79
-7
lines changed

10 files changed

+79
-7
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Build Docker image
2+
3+
on:
4+
push:
5+
tags:
6+
- "*.*.*"
7+
8+
jobs:
9+
build_deploy:
10+
name: Build and Deploy
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
packages: write
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Docker meta
20+
id: meta
21+
uses: docker/metadata-action@v5
22+
with:
23+
images: atendai/evolution-api
24+
images: evoapicloud/evolution-api
25+
tags: type=semver,pattern=v{{version}}
26+
27+
- name: Set up QEMU
28+
uses: docker/setup-qemu-action@v3
29+
30+
- name: Set up Docker Buildx
31+
uses: docker/setup-buildx-action@v3
32+
33+
- name: Login to GitHub Container Registry
34+
uses: docker/login-action@v3
35+
with:
36+
username: ${{ secrets.DOCKER_USERNAME }}
37+
password: ${{ secrets.DOCKER_PASSWORD }}
38+
39+
- name: Build and push
40+
id: docker_build
41+
uses: docker/build-push-action@v5
42+
with:
43+
platforms: linux/amd64,linux/arm64
44+
push: true
45+
tags: ${{ steps.meta.outputs.tags }}
46+
labels: ${{ steps.meta.outputs.labels }}
47+
48+
- name: Image digest
49+
run: echo ${{ steps.docker_build.outputs.digest }}

.github/workflows/publish_docker_image_homolog.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
id: meta
2121
uses: docker/metadata-action@v5
2222
with:
23-
images: atendai/evolution-api-lite
23+
images: evoapicloud/evolution-api-lite
2424
tags: homolog
2525

2626
- name: Set up QEMU

.github/workflows/publish_docker_image_latest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
id: meta
2121
uses: docker/metadata-action@v5
2222
with:
23-
images: atendai/evolution-api-lite
23+
images: evoapicloud/evolution-api-lite
2424
tags: latest
2525

2626
- name: Set up QEMU

Docker/swarm/evolution_api_v2.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: "3.7"
22

33
services:
44
evolution_v2:
5-
image: atendai/evolution-api-lite:latest
5+
image: evoapicloud/evolution-api:latest
66
volumes:
77
- evolution_instances:/evolution/instances
88
networks:

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ RUN apk update && \
55

66
LABEL version="2.2.3" description="Api to control whatsapp features through http requests."
77
LABEL maintainer="Davidson Gomes" git="https://github.com/DavidsonGomes"
8-
LABEL contact="contato@atendai.com"
8+
LABEL contact="contato@evolution-api.com"
99

1010
WORKDIR /evolution
1111

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ a. LOGO and copyright information: In the process of using Evolution API's front
88

99
b. Usage Notification Requirement: If Evolution API is used as part of any project, including closed-source systems (e.g., proprietary software), the user is required to display a clear notification within the system that Evolution API is being utilized. This notification should be visible to system administrators and accessible from the system's documentation or settings page. Failure to comply with this requirement may result in the necessity for a commercial license, as determined by the producer.
1010

11-
Please contact contato@atendai.com to inquire about licensing matters.
11+
Please contact contato@evolution-api.com to inquire about licensing matters.
1212

1313
2. As a contributor, you should agree that:
1414

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<div align="center">
44

5+
[![Docker Image (https://img.shields.io/badge/Docker-Image-blue)](https://hub.docker.com/r/evoapicloud/evolution-api)]
56
[![Whatsapp Group](https://img.shields.io/badge/Group-WhatsApp-%2322BC18)](https://evolution-api.com/whatsapp)
67
[![Discord Community](https://img.shields.io/badge/Discord-Community-blue)](https://evolution-api.com/discord)
78
[![Postman Collection](https://img.shields.io/badge/Postman-Collection-orange)](https://evolution-api.com/postman)

docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
services:
22
api:
33
container_name: evolution_api
4-
image: atendai/evolution-api-lite:latest
4+
image: evoapicloud/evolution-api:latest
55
restart: always
66
depends_on:
77
- redis

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
],
4242
"author": {
4343
"name": "Davidson Gomes",
44-
"email": "contato@atendai.com"
44+
"email": "contato@evolution-api.com"
4545
},
4646
"license": "Apache-2.0",
4747
"bugs": {

src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,17 @@ export class BaileysStartupService extends ChannelStartupService {
936936
await this.baileysCache.delete(received.key.id);
937937
}
938938

939+
// Cache to avoid duplicate messages
940+
const messageKey = `${this.instance.id}_${received.key.id}`;
941+
const cached = await this.baileysCache.get(messageKey);
942+
943+
if (cached) {
944+
this.logger.info(`Message duplicated ignored: ${received.key.id}`);
945+
continue;
946+
}
947+
948+
await this.baileysCache.set(messageKey, true, 30 * 60);
949+
939950
if (
940951
(type !== 'notify' && type !== 'append') ||
941952
received.message?.protocolMessage ||
@@ -1145,6 +1156,17 @@ export class BaileysStartupService extends ChannelStartupService {
11451156
continue;
11461157
}
11471158

1159+
const updateKey = `${this.instance.id}_${key.id}_${update.status}`;
1160+
1161+
const cached = await this.baileysCache.get(updateKey);
1162+
1163+
if (cached) {
1164+
this.logger.info(`Message duplicated ignored: ${key.id}`);
1165+
continue;
1166+
}
1167+
1168+
await this.baileysCache.set(updateKey, true, 30 * 60);
1169+
11481170
if (key.remoteJid !== 'status@broadcast') {
11491171
let pollUpdates: any;
11501172

0 commit comments

Comments
 (0)