795 delete repository asynchonously

Shall fix #795 and #342.

I created this branch on top of #1026, not on top of staging.
Metrics/LineLength: Line is too long. [83/80]