Skip to content

Commit b8c1a64

Browse files
committed
fix: try to fix the connection that is not stable right now
1 parent f3b2116 commit b8c1a64

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
APP_PORT=${{ secrets.APP_PORT }}
7474
DOCKER_CONTAINER_NAME=${{ secrets.DOCKER_CONTAINER_NAME }}
7575
PAT_TOKEN=${{ secrets.PAT_TOKEN }}
76-
GITHUB_REPOSITORY=${{ secrets.GITHUB_REPOSITORY }}
76+
GITHUB_REPOSITORY=${{ github.repository }}
7777
NUMBER_NEWSLETTERS=${{ secrets.NUMBER_NEWSLETTERS }}
7878
NEWSLETTER_JID1=${{ secrets.NEWSLETTER_JID1 }}
7979
NEWSLETTER_NAME1=${{ secrets.NEWSLETTER_NAME1 }}

internal/whatsapp/client.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ func getDetailedSubscriberData(newsletters []NewsletterInfo) (*NewsletterData, e
130130
if err != nil {
131131
return nil, fmt.Errorf("failed to connect: %v", err)
132132
}
133-
defer client.Disconnect()
134133

135134
fmt.Println("Waiting for WhatsApp connection...")
136135
maxWaitTime := 120 * time.Second
@@ -170,6 +169,10 @@ func getDetailedSubscriberData(newsletters []NewsletterInfo) (*NewsletterData, e
170169
})
171170
}
172171

172+
fmt.Println("Data fetched. Keeping session alive for 30 seconds to stabilize...")
173+
time.Sleep(30 * time.Second)
174+
fmt.Println("Disconnecting now.")
175+
173176
return &NewsletterData{
174177
Total: totalSubscribers,
175178
Newsletters: updatedNewsletters,

0 commit comments

Comments
 (0)