Skip to content

chore(daemon): named timeout constants#1027

Merged
andrinoff merged 1 commit intofloatpane:masterfrom
mvanhorn:osc/985-named-timeout-constants
Apr 27, 2026
Merged

chore(daemon): named timeout constants#1027
andrinoff merged 1 commit intofloatpane:masterfrom
mvanhorn:osc/985-named-timeout-constants

Conversation

@mvanhorn
Copy link
Copy Markdown
Contributor

@mvanhorn mvanhorn commented Apr 27, 2026

What?

Replaces ad-hoc 60*time.Second and 30*time.Second literals in daemon/handler.go with two named constants and a brief comment documenting the split, exactly as suggested in the issue body.

const (
    fetchTimeout  = 60 * time.Second
    mutateTimeout = 30 * time.Second
)

fetchTimeout (was 60*time.Second):

  • handleFetchEmails (line 129)
  • handleFetchEmailBody (line 154)
  • async fetch inside handleMarkRead (line 318)

mutateTimeout (was 30*time.Second):

  • handleDeleteEmails (line 193)
  • handleArchiveEmails (line 216)
  • handleMoveEmails (line 239)
  • handleMarkRead (line 262)
  • handleFetchFolders (line 287)

Why?

fetchTimeout covers reads against the upstream IMAP provider, which can return large bodies and so are given more headroom. mutateTimeout covers state-changing operations and folder listings, which are bounded by IMAP command latency rather than payload size.

If the maintainer wants handleFetchFolders reclassified to fetchTimeout (which would be a behavior change from 30s to 60s), happy to do that as a follow-up — kept it at the existing value here to keep this purely a refactor.

Closes #985.

Replaces ad-hoc 60s/30s literals across daemon/handler.go with
fetchTimeout and mutateTimeout constants, with a comment documenting
the rationale.

Closes floatpane#985.
@mvanhorn mvanhorn requested a review from a team as a code owner April 27, 2026 07:41
Copy link
Copy Markdown
Member

@floatpanebot floatpanebot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mvanhorn! Please fix the following issues with your PR:

  • Title: Is too long (51 characters). The PR title must be strictly under 40 characters.
  • Body: Missing the ## What? or ## Why? headings required by the PR template.

@github-actions github-actions Bot added bug Something isn't working chore labels Apr 27, 2026
@LeaWhoCodes
Copy link
Copy Markdown
Member

@mvanhorn follow the format, please

@mvanhorn mvanhorn changed the title fix(daemon): use named timeout constants in handler fix(daemon): named timeout constants Apr 27, 2026
@floatpanebot floatpanebot dismissed their stale review April 27, 2026 15:09

Formatting issues have been resolved. Thank you!

Copy link
Copy Markdown
Member

@andrinoff andrinoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@andrinoff andrinoff changed the title fix(daemon): named timeout constants chore(daemon): named timeout constants Apr 27, 2026
@andrinoff andrinoff removed the bug Something isn't working label Apr 27, 2026
@andrinoff andrinoff merged commit b8f1930 into floatpane:master Apr 27, 2026
22 of 23 checks passed
@mvanhorn
Copy link
Copy Markdown
Contributor Author

Cheers for merging this @andrinoff, thanks. Replacing the bare 60s and 30s literals with fetchTimeout and mutateTimeout makes the split self-documenting wherever someone reads handler.go.

@mvanhorn
Copy link
Copy Markdown
Contributor Author

Appreciate the quick turnaround @andrinoff. Naming fetchTimeout and mutateTimeout makes the daemon handler intent obvious at the callsite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Inconsistent timeout values across daemon handlers

4 participants