Skip to content

Commit a80fa04

Browse files
committed
Reduce the number of messages per minute
1 parent 392af5d commit a80fa04

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

api/cmd/loadtest/main.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,19 @@ func main() {
1818
log.Fatal("Error loading .env file")
1919
}
2020

21-
for i := 0; i < 20; i++ {
21+
for i := 0; i < 100; i++ {
2222
var responsePayload string
2323
err = requests.
2424
URL("/v1/messages/send").
2525
Host("api.httpsms.com").
2626
// Host("localhost:8000").
2727
// Scheme("http").
28-
Header("x-api-key", os.Getenv("API_KEY")).
28+
Header("x-api-key", os.Getenv("HTTPSMS_API_KEY")).
2929
BodyJSON(&map[string]string{
3030
"content": fmt.Sprintf("testing http api sample: [%d]", i),
31-
"from": "+37259139660",
32-
"to": "+37253517181",
31+
"from": os.Getenv("SIM_1"),
32+
"to": os.Getenv("SIM_2"),
33+
"sim": "SIM2",
3334
}).
3435
ToString(&responsePayload).
3536
Fetch(context.Background())

api/pkg/services/phone_service.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,10 @@ func (service *PhoneService) createPhone(ctx context.Context, params PhoneUpsert
170170
ID: uuid.New(),
171171
UserID: params.UserID,
172172
FcmToken: params.FcmToken,
173-
// Android has a limit of 30 SMS messages per minute without user permission
173+
// Android has a limit of 30 SMS messages per minute without user permission, to be safe let's use 10 messages per minute
174174
// https://android.googlesource.com/platform/frameworks/opt/telephony/+/master/src/java/com/android/internal/telephony/SmsUsageMonitor.java#80
175-
MessagesPerMinute: 29,
176-
MessageExpirationSeconds: 15 * 60, // 30 minutes
175+
MessagesPerMinute: 10,
176+
MessageExpirationSeconds: 15 * 60, // 15 minutes
177177
MaxSendAttempts: 2,
178178
IsDualSIM: params.IsDualSIM,
179179
PhoneNumber: phonenumbers.Format(&params.PhoneNumber, phonenumbers.E164),

0 commit comments

Comments
 (0)