Skip to content

Add Coroutine Support for Asynchronous Task Handling #1

@alanhasn

Description

@alanhasn

🔧 Feature: Coroutine Integration (Planned)

📌 Summary

Currently, all the service operations in the project are written synchronously or use runBlocking where needed. While this works for a small CLI application, it blocks threads and can affect performance when scaling or adding concurrent tasks.

To improve scalability, responsiveness, and architecture, I plan to refactor the project to fully support Kotlin Coroutines in service layers, especially:

  • TransactionService
  • BankService
  • UserService

✅ Goals

  • Refactor suspendable methods to use structured concurrency properly
  • Use coroutine scopes (CoroutineScope, SupervisorJob, etc.) where needed
  • Improve responsiveness and non-blocking I/O
  • Avoid runBlocking in the CLI whenever possible
  • Handle exceptions gracefully using coroutine context

📍 Tasks

  • Introduce CoroutineScope properly at application level
  • Replace runBlocking in CLI with structured calls
  • Convert service methods to suspend functions
  • Use Dispatchers.IO only where needed
  • Add unit tests to validate coroutine behavior
  • Update documentation

🚀 Benefits

  • Better performance and non-blocking behavior
  • Cleaner architecture
  • Easier future transition to multi-threaded or reactive CLI
  • Prepares the project for potential backend/server refactor

📌 Priority

Low (for now) — but recommended for future scalability and clean architecture.


🔖 Labels

enhancement, refactor, coroutines, good first issue (if you want contributors to help)


Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions