Skip to content

Commit 344c10f

Browse files
committed
Handle events for messages with multiple segments
1 parent 5b8b883 commit 344c10f

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

‎android/app/src/main/java/com/httpsms/Receiver.kt‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ object Receiver {
2020
Timber.w("cannot handle message with id [$messageId] because the user is not active")
2121
return false
2222
}
23+
24+
if(messageId.contains(".")) {
25+
Timber.d("message id [${messageId}] is for multipart segment [${messageId.split(".")[1]}]")
26+
return false
27+
}
28+
2329
return true
2430
}
2531
}

‎api/cmd/experiments/main.go‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,23 @@ func main() {
2323

2424
func loadTest() {
2525
wg := sync.WaitGroup{}
26-
for i := 0; i < 2; i++ {
26+
for i := 0; i < 1; i++ {
2727
wg.Add(1)
2828
go func(count int) {
29-
sendSMS(count)
29+
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))
30+
sendSMS(fmt.Sprintf("[%d] Hello, World", count))
3031
wg.Done()
3132
}(i)
3233

3334
}
3435
wg.Wait()
3536
}
3637

37-
func sendSMS(count int) {
38+
func sendSMS(content string) {
3839
var response string
3940
err := requests.URL(os.Getenv("BASIC_URL")).
4041
BodyJSON(map[string]any{
41-
"content": fmt.Sprintf("Hello, World [%d]", count),
42+
"content": content,
4243
"from": os.Getenv("BASIC_FROM"),
4344
"to": os.Getenv("BASIC_TO"),
4445
}).

0 commit comments

Comments
 (0)