on master help sign in
Fix messages not being received by threading poll cursor through client state
commitfa9d38a3fad244670e1576c664bf6ba789d0168e authoriko <mail@iko.soy> dateFri 27 Mar 2026, 13:08 (7 months ago) parent1025ec4
30 files changed+31−29
client/ApiClient.fs+3−3 client/App.fs+16−14 client/bin/Debug/net10.0-ios/iossimulator-arm64/Skrepka.app/Skrepka.dll client/bin/Debug/net10.0-ios/iossimulator-arm64/Skrepka.app/Skrepka.pdb client/bin/Debug/net10.0-ios/iossimulator-arm64/Skrepka.app/_CodeSignature/CodeResources+4−4 client/bin/Debug/net10.0-ios/iossimulator-arm64/Skrepka.dll client/bin/Debug/net10.0-ios/iossimulator-arm64/Skrepka.pdb client/bin/Debug/net10.0-maccatalyst/maccatalyst-arm64/Skrepka.app/Contents/MonoBundle/Skrepka.dll client/bin/Debug/net10.0-maccatalyst/maccatalyst-arm64/Skrepka.app/Contents/MonoBundle/Skrepka.pdb client/bin/Debug/net10.0-maccatalyst/maccatalyst-arm64/Skrepka.app/Contents/_CodeSignature/CodeResources+2−2 client/bin/Debug/net10.0-maccatalyst/maccatalyst-arm64/Skrepka.dll client/bin/Debug/net10.0-maccatalyst/maccatalyst-arm64/Skrepka.pdb client/obj/Debug/net10.0-ios/iossimulator-arm64/Skrepka.AssemblyInfo.fs+1−1 client/obj/Debug/net10.0-ios/iossimulator-arm64/Skrepka.AssemblyInfoInputs.cache+1−1 client/obj/Debug/net10.0-ios/iossimulator-arm64/Skrepka.dll client/obj/Debug/net10.0-ios/iossimulator-arm64/Skrepka.pdb client/obj/Debug/net10.0-ios/iossimulator-arm64/Skrepka.sourcelink.json+1−1 client/obj/Debug/net10.0-ios/iossimulator-arm64/linked/Skrepka.dll client/obj/Debug/net10.0-ios/iossimulator-arm64/linked/Skrepka.pdb client/obj/Debug/net10.0-ios/iossimulator-arm64/ref/Skrepka.dll client/obj/Debug/net10.0-ios/iossimulator-arm64/refint/Skrepka.dll client/obj/Debug/net10.0-maccatalyst/maccatalyst-arm64/Skrepka.AssemblyInfo.fs+1−1 client/obj/Debug/net10.0-maccatalyst/maccatalyst-arm64/Skrepka.AssemblyInfoInputs.cache+1−1 client/obj/Debug/net10.0-maccatalyst/maccatalyst-arm64/Skrepka.dll client/obj/Debug/net10.0-maccatalyst/maccatalyst-arm64/Skrepka.pdb client/obj/Debug/net10.0-maccatalyst/maccatalyst-arm64/Skrepka.sourcelink.json+1−1 client/obj/Debug/net10.0-maccatalyst/maccatalyst-arm64/linked/Skrepka.dll client/obj/Debug/net10.0-maccatalyst/maccatalyst-arm64/linked/Skrepka.pdb client/obj/Debug/net10.0-maccatalyst/maccatalyst-arm64/ref/Skrepka.dll client/obj/Debug/net10.0-maccatalyst/maccatalyst-arm64/refint/Skrepka.dll
client/ApiClient.fs+3−3
@@ -81,16 +81,16 @@ module ApiClient =
8181 c.Timeout <- System.Threading.Timeout.InfiniteTimeSpan
8282 c
8383
84− let poll (serverUrl: string) (token: string) =
84+ let poll (serverUrl: string) (token: string) (cursor: int64) =
8585 async {
86− let request = new HttpRequestMessage(HttpMethod.Get, $"{serverUrl}/poll?timeout=30")
86+ let request = new HttpRequestMessage(HttpMethod.Get, $"{serverUrl}/poll?cursor={cursor}&timeout=30")
8787 request.Headers.Add("Authorization", $"Bearer {token}")
8888
8989 let! response = pollClient.SendAsync(request) |> Async.AwaitTask
9090 let! text = response.Content.ReadAsStringAsync() |> Async.AwaitTask
9191 let doc = JsonDocument.Parse(text)
9292 let root = expectObject doc "/poll"
93− let cursor = root.GetProperty("cursor").GetString()
93+ let cursor = root.GetProperty("cursor").GetInt64()
9494
9595 // Knot runtime wraps relations as [[record1, record2, ...]]
9696 let eventsOuter = root.GetProperty("events")
client/App.fs+16−14
@@ -46,7 +46,8 @@ module App =
4646 ComposeText: string
4747 NewPubkey: string
4848 NewNickname: string
49− Error: string option }
49+ Error: string option
50+ PollCursor: int64 }
5051
5152 // ── Msg ──
5253
@@ -66,7 +67,7 @@ module App =
6667 | SetNewNickname of string
6768 | DoSaveContact
6869 | DoDeleteContact of string
69− | PollResult of (string * string * int64 * string) list * string
70+ | PollResult of (string * string * int64 * string) list * string * int64
7071 | DoPoll
7172 | CopyPubKey
7273 | DismissError
@@ -84,7 +85,7 @@ module App =
8485 pubKeyHex: string *
8586 recipPubHex: string *
8687 text: string
87− | CmdPoll of url: string * token: string * privKey: byte[]
88+ | CmdPoll of url: string * token: string * privKey: byte[] * cursor: int64
8889 | CmdCopyToClipboard of string
8990
9091 // ── Helpers ──
@@ -112,7 +113,8 @@ module App =
112113 ComposeText = ""
113114 NewPubkey = ""
114115 NewNickname = ""
115− Error = None },
116+ Error = None
117+ PollCursor = 0L },
116118 []
117119
118120 // ── Update ──
@@ -143,7 +145,7 @@ module App =
143145 Conn = Online token
144146 Page = Conversations
145147 Error = None },
146− [ CmdPoll(model.ServerUrl, token, model.PrivKey.Value) ]
148+ [ CmdPoll(model.ServerUrl, token, model.PrivKey.Value, model.PollCursor) ]
147149
148150 | AuthErr err -> { model with Conn = Offline; Error = Some err }, []
149151
@@ -170,7 +172,7 @@ module App =
170172
171173 | Sent _ -> model, []
172174
173− | PollResult(incoming, status) ->
175+ | PollResult(incoming, status, newCursor) ->
174176 let model' =
175177 incoming
176178 |> List.fold
@@ -195,15 +197,15 @@ module App =
195197 { m with
196198 Contacts = contacts
197199 Messages = m.Messages |> Map.add fromPk (msgs @ [ newMsg ]) })
198− { model with PollStatus = status }
200+ { model with PollStatus = status; PollCursor = newCursor }
199201
200202 match model'.Conn with
201− | Online token -> model', [ CmdPoll(model'.ServerUrl, token, model'.PrivKey.Value) ]
203+ | Online token -> model', [ CmdPoll(model'.ServerUrl, token, model'.PrivKey.Value, model'.PollCursor) ]
202204 | _ -> model', []
203205
204206 | DoPoll ->
205207 match model.Conn, model.PrivKey with
206− | Online token, Some priv -> model, [ CmdPoll(model.ServerUrl, token, priv) ]
208+ | Online token, Some priv -> model, [ CmdPoll(model.ServerUrl, token, priv, model.PollCursor) ]
207209 | _ -> model, []
208210
209211 | SetNewPubkey pk -> { model with NewPubkey = pk }, []
@@ -294,10 +296,10 @@ module App =
294296 return DismissError // TODO: show send errors properly
295297 })
296298
297− | CmdPoll(url, token, privKey) ->
299+ | CmdPoll(url, token, privKey, cursor) ->
298300 asyncCmd (async {
299301 try
300− let! (events, _) = ApiClient.poll url token
302+ let! (events, newCursor) = ApiClient.poll url token cursor
301303 let messages = ResizeArray()
302304 let ackIds = ResizeArray()
303305 let errors = ResizeArray()
@@ -335,15 +337,15 @@ module App =
335337 $"[{now}] evts:{events.Length} msgs:{messages.Count} errs:{errors.Count}"
336338 + (if errors.Count > 0 then $" [{errors.[0]}]" else "")
337339
338− return PollResult(Seq.toList messages, status)
340+ return PollResult(Seq.toList messages, status, newCursor)
339341 with
340342 | :? System.Threading.Tasks.TaskCanceledException ->
341343 // Normal timeout from long poll — just retry
342− return PollResult([], "polling...")
344+ return PollResult([], "polling...", cursor)
343345 | ex ->
344346 let now = DateTimeOffset.UtcNow.ToString("HH:mm:ss")
345347 do! Async.Sleep 3000
346− return PollResult([], $"[{now}] poll error: {ex.Message}")
348+ return PollResult([], $"[{now}] poll error: {ex.Message}", cursor)
347349 })
348350
349351 | CmdCopyToClipboard text ->
client/bin/Debug/net10.0-ios/iossimulator-arm64/Skrepka.app/Skrepka.dll

Binary file not shown.

client/bin/Debug/net10.0-ios/iossimulator-arm64/Skrepka.app/Skrepka.pdb

Binary file not shown.

client/bin/Debug/net10.0-ios/iossimulator-arm64/Skrepka.app/_CodeSignature/CodeResources+4−4
@@ -162,11 +162,11 @@
162162 </data>
163163 <key>Skrepka.dll</key>
164164 <data>
165− cLMiN59WETvez5dx0uXUZoSTPb4=
165+ ihxkdJmILCX2rvNfx8IAKfrjiRw=
166166 </data>
167167 <key>Skrepka.pdb</key>
168168 <data>
169− ldyZfrWrMd9ycj/oEBvJhDAsVME=
169+ 5Ef95J0Y0SPaPbiv94B4OI5dvt4=
170170 </data>
171171 <key>Sodium.Core.dll</key>
172172 <data>
@@ -1382,14 +1382,14 @@
13821382 <dict>
13831383 <key>hash2</key>
13841384 <data>
1385− t+CLPQktYsiTOLd72KrLk+9R6smlb9kRcl3LVv+EYBY=
1385+ jA699ETKlhsSyP0dr9yKgsVa246KniFBNn6h+H093lI=
13861386 </data>
13871387 </dict>
13881388 <key>Skrepka.pdb</key>
13891389 <dict>
13901390 <key>hash2</key>
13911391 <data>
1392− GvVY1szkv9OBBCgEdAZqPqj+Taow0e372j3aKZx1csQ=
1392+ 9xCu8W4xbM0EJu+r0fyBhBs95Lz7i0LEqYeCvuPHiYQ=
13931393 </data>
13941394 </dict>
13951395 <key>Sodium.Core.dll</key>
client/bin/Debug/net10.0-ios/iossimulator-arm64/Skrepka.dll

Binary file not shown.

client/bin/Debug/net10.0-ios/iossimulator-arm64/Skrepka.pdb

Binary file not shown.

client/bin/Debug/net10.0-maccatalyst/maccatalyst-arm64/Skrepka.app/Contents/MonoBundle/Skrepka.dll

Binary file not shown.

client/bin/Debug/net10.0-maccatalyst/maccatalyst-arm64/Skrepka.app/Contents/MonoBundle/Skrepka.pdb

Binary file not shown.

client/bin/Debug/net10.0-maccatalyst/maccatalyst-arm64/Skrepka.app/Contents/_CodeSignature/CodeResources+2−2
@@ -240,14 +240,14 @@
240240 <dict>
241241 <key>hash2</key>
242242 <data>
243− 0IwboWcxGg+igGOs/iPuXTnkrFWofjpU2HruAF/Cz1Y=
243+ SkrTLt6NpdxkCOrg3x+0va15w21CQqSaHXDAj+klfQY=
244244 </data>
245245 </dict>
246246 <key>MonoBundle/Skrepka.pdb</key>
247247 <dict>
248248 <key>hash2</key>
249249 <data>
250− aaf14lJ3aUAY1W3Za3iFIIq7GWlqrVjZxVYmH/Px/ps=
250+ 1pt18PVRQANYqIOx8PEoowFdG5ubKia23BbX/3qPn2Q=
251251 </data>
252252 </dict>
253253 <key>MonoBundle/Sodium.Core.dll</key>
client/bin/Debug/net10.0-maccatalyst/maccatalyst-arm64/Skrepka.dll

Binary file not shown.

client/bin/Debug/net10.0-maccatalyst/maccatalyst-arm64/Skrepka.pdb

Binary file not shown.

client/obj/Debug/net10.0-ios/iossimulator-arm64/Skrepka.AssemblyInfo.fs+1−1
@@ -10,7 +10,7 @@ open System.Reflection
1010[<assembly: System.Reflection.AssemblyCompanyAttribute("Skrepka")>]
1111[<assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")>]
1212[<assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")>]
13−[<assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0+346c12ecffe87438fdad84bea4dff973f4fc9eec")>]
13+[<assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0+1025ec42bdc63a36e82c2b05547b3ddfc72a0761")>]
1414[<assembly: System.Reflection.AssemblyProductAttribute("Skrepka")>]
1515[<assembly: System.Reflection.AssemblyTitleAttribute("Skrepka")>]
1616[<assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")>]
client/obj/Debug/net10.0-ios/iossimulator-arm64/Skrepka.AssemblyInfoInputs.cache+1−1
@@ -1 +1 @@
1−6a753f697574f344344f60a7ce91110bcf66456ca91f9a28f3d6610430ec814d
1+608be3485c5b02f0859bc57c944a7d90f027c871f4620f1b2625c376aa40ab39
client/obj/Debug/net10.0-ios/iossimulator-arm64/Skrepka.dll

Binary file not shown.

client/obj/Debug/net10.0-ios/iossimulator-arm64/Skrepka.pdb

Binary file not shown.

client/obj/Debug/net10.0-ios/iossimulator-arm64/Skrepka.sourcelink.json+1−1
@@ -1 +1 @@
1−{"documents":{"/Users/iko/Developer/skrepka/*":"https://raw.githubusercontent.com/ilyakooo0/skrepka/346c12ecffe87438fdad84bea4dff973f4fc9eec/*"}}
1+{"documents":{"/Users/iko/Developer/skrepka/*":"https://raw.githubusercontent.com/ilyakooo0/skrepka/1025ec42bdc63a36e82c2b05547b3ddfc72a0761/*"}}
client/obj/Debug/net10.0-ios/iossimulator-arm64/linked/Skrepka.dll

Binary file not shown.

client/obj/Debug/net10.0-ios/iossimulator-arm64/linked/Skrepka.pdb

Binary file not shown.

client/obj/Debug/net10.0-ios/iossimulator-arm64/ref/Skrepka.dll

Binary file not shown.

client/obj/Debug/net10.0-ios/iossimulator-arm64/refint/Skrepka.dll

Binary file not shown.

client/obj/Debug/net10.0-maccatalyst/maccatalyst-arm64/Skrepka.AssemblyInfo.fs+1−1
@@ -10,7 +10,7 @@ open System.Reflection
1010[<assembly: System.Reflection.AssemblyCompanyAttribute("Skrepka")>]
1111[<assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")>]
1212[<assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")>]
13−[<assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0+346c12ecffe87438fdad84bea4dff973f4fc9eec")>]
13+[<assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0+1025ec42bdc63a36e82c2b05547b3ddfc72a0761")>]
1414[<assembly: System.Reflection.AssemblyProductAttribute("Skrepka")>]
1515[<assembly: System.Reflection.AssemblyTitleAttribute("Skrepka")>]
1616[<assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")>]
client/obj/Debug/net10.0-maccatalyst/maccatalyst-arm64/Skrepka.AssemblyInfoInputs.cache+1−1
@@ -1 +1 @@
1−a4046d7b839a68f608d1c269bcb1a56b4af044b840ddb7c5384c5348a63f2bce
1+6ce084ea2001e68a95078f1ad7ce56a873907d46e9df803c23a3c8e674e8ede8
client/obj/Debug/net10.0-maccatalyst/maccatalyst-arm64/Skrepka.dll

Binary file not shown.

client/obj/Debug/net10.0-maccatalyst/maccatalyst-arm64/Skrepka.pdb

Binary file not shown.

client/obj/Debug/net10.0-maccatalyst/maccatalyst-arm64/Skrepka.sourcelink.json+1−1
@@ -1 +1 @@
1−{"documents":{"/Users/iko/Developer/skrepka/*":"https://raw.githubusercontent.com/ilyakooo0/skrepka/346c12ecffe87438fdad84bea4dff973f4fc9eec/*"}}
1+{"documents":{"/Users/iko/Developer/skrepka/*":"https://raw.githubusercontent.com/ilyakooo0/skrepka/1025ec42bdc63a36e82c2b05547b3ddfc72a0761/*"}}
client/obj/Debug/net10.0-maccatalyst/maccatalyst-arm64/linked/Skrepka.dll

Binary file not shown.

client/obj/Debug/net10.0-maccatalyst/maccatalyst-arm64/linked/Skrepka.pdb

Binary file not shown.

client/obj/Debug/net10.0-maccatalyst/maccatalyst-arm64/ref/Skrepka.dll

Binary file not shown.

client/obj/Debug/net10.0-maccatalyst/maccatalyst-arm64/refint/Skrepka.dll

Binary file not shown.