Skip to content

Add Async/Await Support for Flag Operations #22

@oasaph

Description

@oasaph

Description

Implement async/await support for flag fetching and updates to improve performance in async applications and prevent blocking operations.

Goals

  • Async flag fetching
  • Non-blocking update operations
  • Compatible with popular async frameworks
  • Maintain sync API for backward compatibility

Proposed Features

  1. Async Flaggle client
  2. Async storage operations
  3. Async event listeners
  4. Integration with async web frameworks

Example Interface

from python_flaggle import AsyncFlaggle

async def main():
    flaggle = AsyncFlaggle(
        url="https://api.example.com/flags",
        interval=60
    )
    
    # Async flag checks
    if await flaggle.flags["feature_a"].is_enabled():
        await enable_feature()
    
    # Async update operations
    await flaggle.update_flags()

# Framework integration
app = FastAPI()

@app.get("/feature")
async def check_feature():
    return {"enabled": await flaggle.flags["feature"].is_enabled()}

Acceptance Criteria

  • Async Flaggle implementation
  • Async storage operations
  • Async event system
  • Integration examples with FastAPI/aiohttp
  • Performance benchmarks
  • Migration guide for existing users

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions