<s> from . . import celery , mail , create_app , db <EOL> from . . models import User , Post , Webpush <EOL> @ celery . task <EOL> def send_async_email ( msg ) : <EOL> app = create_app ( '<STR_LIT:default>' ) <EOL> with app . app_context ( ) : <EOL> mail . send ( msg ) <EOL> @ celery . task <EOL> def send_async_webpush ( username , postid ) : <EOL> app = create_app ( '<STR_LIT:default>' ) <EOL> with app . app_context ( ) : <EOL> user = User . query . filter_by ( username = username ) . first ( ) <EOL> post = Post . query . get ( postid ) <EOL> followers = user . followers <EOL> for follower in followers : <EOL> if follower . follower != user : <EOL> webpush = Webpush ( sendto = follower . follower , author = user , post_id = post . id ) </s>
