on master help sign in
Fix server poll blocking indefinitely by returning empty events instead of retry
commit8f74adf03adee652766e6c8ba1028336d0955458 authoriko <mail@iko.soy> dateSun 19 Apr 2026, 23:20 (6 months ago) parente4d8d76
2 files changed+24−16
client/ViewConversations.fs+13−7 server.knot+11−9
client/ViewConversations.fs+13−7
@@ -84,12 +84,18 @@ module ViewConversations =
8484 )
8585
8686 let bar =
87− (Grid([ Dimension.Auto; Dimension.Star; Dimension.Auto ], [ Dimension.Auto ]) {
88− (smallImageButton None (SetPage Settings)).gridColumn (0)
89− (textField "" Search).margin(8.).verticalAlignment(VerticalAlignment.Stretch).gridColumn (1)
90− (smallTextButton "+" (SetPage(AddContact("")))).gridColumn (2)
91− })
92− // .margin(20.)
93− .horizontalAlignment (HorizontalAlignment.Stretch)
87+ VStack(0.) {
88+ TextBlock($"{connStatusLabel model.Auth} | {model.PollStatus}")
89+ .fontSize(10.)
90+ .foreground(SolidColorBrush(Colors.Gray))
91+ .centerText ()
92+
93+ (Grid([ Dimension.Auto; Dimension.Star; Dimension.Auto ], [ Dimension.Auto ]) {
94+ (smallImageButton None (SetPage Settings)).gridColumn (0)
95+ (textField "" Search).margin(8.).verticalAlignment(VerticalAlignment.Stretch).gridColumn (1)
96+ (smallTextButton "+" (SetPage(AddContact("")))).gridColumn (2)
97+ })
98+ .horizontalAlignment (HorizontalAlignment.Stretch)
99+ }
94100
95101 withBottomBar bar content
server.knot+11−9
@@ -47,6 +47,9 @@ gossipOriginHops = 2
4747
4848backgroundPruneInterval : Int<Ms>
4949backgroundPruneInterval = 30000 -- 30 seconds
50+pollSleepInterval : Int<Ms>
51+pollSleepInterval = 500 -- 500ms between poll attempts
52+maxPollWaitAttempts = 60 -- 60 * 500ms = 30 second max long-poll
5053federationEnabled = federationSecret != ""
5154federationAuth = "Bearer " ++ federationSecret
5255federationUrl = \server -> federationScheme ++ server
@@ -815,15 +818,14 @@ pruneAndRetry = \t -> do
815818
816819pollOnce = \token cursor -> do
817820 t <- now
818− atomic do
819− sessions <- *sessions
820− let auth = authenticateSession sessions token t
821− case auth of
822− Unauthorized {} ->
823− yield (PollUnauthorized {})
824− Authorized {pubkey} -> do
825− seqCounter <- *seqCounter
826− let clampedCursor = clamp 0 (max seqCounter t) cursor
821+ sessions <- *sessions
822+ let auth = authenticateSession sessions token t
823+ case auth of
824+ Unauthorized {} -> yield (PollUnauthorized {})
825+ Authorized {pubkey} -> do
826+ seqCounter <- *seqCounter
827+ let clampedCursor = clamp 0 (max seqCounter t) cursor
828+ atomic do
827829 matchingMsgs <- do
828830 m <- *messages
829831 where m.toKey == pubkey && m.receivedAt >= t - messageMaxAge && m.receivedAt > clampedCursor