Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Async isn't actually being used, and prevents ctrl+c from correctly exiting the app #130

Closed
waynew opened this issue May 21, 2021 · 1 comment · Fixed by #131
Closed
Labels
bug Something isn't working

Comments

@waynew
Copy link

waynew commented May 21, 2021

When I first started trying reviews, ^C didn't work very well... I had to bash it several times to get the app to quit.

Looking a bit closer, at the code, render in tasks.py is actually a blocking function.

In cli/main.py all of the async code can be removed:

import asyncclick as click

from ..tasks import render, single_render
from ..version import __version__

CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])


@click.group(context_settings=CONTEXT_SETTINGS)
@click.version_option(__version__, "-v", "--version", message="version %(version)s")
def cli() -> None:
    """Reviews - A terminal UI Dashboard for monitoring code review requests.\n

    For feature requests or bug reports: https://github.com/apoclyps/reviews/issues
    """


@cli.command(help="Visualize code review requests as a Dashboard")
@click.option("-r", "--reload/--no-reload", default=True, is_flag=True)
def dashboard(reload: bool) -> None:
    """
    Command:\n
        reviews dashboard

    Usage:\n
        reviews dashboard --reload \n
        reviews dashboard --no-reload \n
    """

    click.echo("loading dashboard")

    if reload:
        render()
    else:
        single_render()


def main() -> None:
    """Entry point to CLI"""
    cli()

In my few manual tests this runs exactly the same as it did before - but now ^C will actually exit the program.

@apoclyps apoclyps changed the title Async isn't actually being used, and prevents ctrl+c from correctly exiting the app [BUG] Async isn't actually being used, and prevents ctrl+c from correctly exiting the app May 22, 2021
@apoclyps apoclyps added the bug Something isn't working label May 22, 2021
@apoclyps
Copy link
Owner

apoclyps commented May 22, 2021

Thanks for the feedback @waynew and opening this bug ticket - I agree this was a pain point of using reviews.

For context (if others review this thread in the future). The initial spike introduced asyncclick as a quick and easy way to split the updates from renders but it was never fully implemented and a lot of the code got left around. #95 and #109 was the start of removing it but it's great to finally remove async and resolve this bug.

I'll ship a 0.1.8 version with the latest fixes today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants