Skip to content

feat: pass app state / lifespan for shared resources (optional design) #18

Closed

Description

@ZhuchkaTriplesix

Context

  • __rsgi_init__ is a no-op. Users need a place to run create_engine, Redis client setup, etc.

Options

  1. Subclass App and set attributes in __rsgi_init__ (if Granian calls it in the same process as workers).
  2. Factory pattern: app = create_app() per worker, documented in docs.
  3. Native State on the Rust App (larger change).

Acceptance criteria

  • Example in examples/ with an asyncio pool or similar; document caveats for multi-process Granian.

Research

  • How Granian workers fork or spawn relative to RSGI init.

Activity

  1. added this to the v0.2.0 milestone on Apr 26, 2026
  2. added a commit that references this issue on Apr 26, 2026
  3. ZhuchkaTriplesix commented on Apr 26, 2026

    @ZhuchkaTriplesix
    MemberAuthor

    Reopened after backlog review (2026-04-26): implementation is partial or the topic remains active (see .github/ISSUE_BACKLOG/bodies/018.md and PRIORITIES.md).

  4. ZhuchkaTriplesix commented on Apr 26, 2026

    @ZhuchkaTriplesix
    MemberAuthor

    Note: body file is .github/ISSUE_BACKLOG/bodies/18.md.

  5. added a commit that references this issue on Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions