Skip to content

Commit

Permalink
try to repush again less often. check count before reading db values
Browse files Browse the repository at this point in the history
  • Loading branch information
zoff99 committed Mar 1, 2024
1 parent a4bdc62 commit 5224a74
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/main/kotlin/com/zoffcc/applications/trifa/TrifaToxService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ class TrifaToxService
// --- send pending 1-on-1 text messages here --------------
if (online_button_text_wrapper != "offline")
{
if ((last_resend_pending_messages4_ms + (5 * 1000)) < System.currentTimeMillis())
if ((last_resend_pending_messages4_ms + (10 * 1000)) < System.currentTimeMillis())
{
last_resend_pending_messages4_ms = System.currentTimeMillis()
if (DB_PREF__send_push_notifications == true)
Expand Down Expand Up @@ -933,6 +933,23 @@ class TrifaToxService
{
// HINT: if we have not received a "read receipt" for msgV3 within 10 seconds, then we trigger a push again
val cutoff_sent_time = System.currentTimeMillis() - (10 * 1000)

// first check:
val m_push_count = orma!!.selectFromMessage().directionEq(1).
msg_versionEq(0).
TRIFA_MESSAGE_TYPEEq(TRIFAGlobals.TRIFA_MSG_TYPE.TRIFA_MSG_TYPE_TEXT.value).
sent_pushEq(0).
readEq(false).
orderBySent_timestampAsc().
sent_timestampLt(cutoff_sent_time).
count()

Log.i(TAG, "resend_push_for_v3_messages:m_push_count=" + m_push_count)
if (m_push_count < 1)
{
return
}

val m_push: List<Message>? = orma!!.selectFromMessage().directionEq(1).
msg_versionEq(0).
TRIFA_MESSAGE_TYPEEq(TRIFAGlobals.TRIFA_MSG_TYPE.TRIFA_MSG_TYPE_TEXT.value).
Expand Down

0 comments on commit 5224a74

Please sign in to comment.