Skip to content

Commit b751051

Browse files
committed
Do not send sent events to the server for multipart messages with invalid ID
1 parent bd14d3e commit b751051

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

android/app/src/main/java/com/httpsms/SentReceiver.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ internal class SentReceiver : BroadcastReceiver() {
3131
}
3232

3333
private fun handleMessageSent(context: Context, messageId: String?) {
34+
if (!Receiver.isValid(context, messageId)) {
35+
return
36+
}
37+
3438
val constraints = Constraints.Builder()
3539
.setRequiredNetworkType(NetworkType.CONNECTED)
3640
.build()

api/cmd/experiments/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ func main() {
2727
logger := container.Logger()
2828

2929
logger.Info("Starting experiments")
30+
loadTest()
3031
}
3132

3233
func text3CX() {
@@ -51,7 +52,6 @@ func loadTest() {
5152
wg.Add(1)
5253
go func(count int) {
5354
sendSMS(fmt.Sprintf("[%d] In the quiet of the night, the stars above whisper secrets of the universe. We, mere stardust, seek meaning in their cosmic dance, yearning to unlock the mysteries of existence that stretch far beyond our earthly bounds.", count))
54-
sendSMS(fmt.Sprintf("[%d] Hello, World", count))
5555
wg.Done()
5656
}(i)
5757

api/cmd/loadtest/main.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ func main() {
2020
if err != nil {
2121
log.Fatal("Error loading .env file")
2222
}
23-
24-
bulkSend()
23+
sendSingle()
2524
}
2625

2726
func bulkSend() {
@@ -51,7 +50,7 @@ func bulkSend() {
5150
}
5251

5352
func sendSingle() {
54-
for i := 0; i < 100; i++ {
53+
for i := 0; i < 1; i++ {
5554
var responsePayload string
5655
err := requests.
5756
URL("/v1/messages/send").
@@ -60,7 +59,7 @@ func sendSingle() {
6059
// Scheme("http").
6160
Header("x-api-key", os.Getenv("HTTPSMS_KEY")).
6261
BodyJSON(&map[string]string{
63-
"content": fmt.Sprintf("Load Test[%d]", i),
62+
"content": fmt.Sprintf("[%s] In the quiet of the night, the stars above whisper secrets of the universe. We, mere stardust, seek meaning in their cosmic dance, yearning to unlock the mysteries of existence that stretch far beyond our earthly bounds.", time.Now()),
6463
"from": os.Getenv("HTTPSMS_FROM"),
6564
"to": os.Getenv("HTTPSMS_TO"),
6665
"request_id": fmt.Sprintf("load-%s-%d", uuid.NewString(), i),

0 commit comments

Comments
 (0)