37ed7b MyBS: Save hoarded cookies to disk

Authored and Committed by Michal Suchanek 2 years ago
    MyBS: Save hoarded cookies to disk
    
    The performance of the OBS SSH authentication system is very bad, and
    can be overwhelmed by about 1 authentication/s.
    
    With osc saving cookies to disk this is not seen as problem.
    
    Saving cookies to disk in MyBS should work around the authentication
    system performance problem until it's resolved.
    
    The design ensures that processes competing for authentication use the
    same cookie once one become available rether than authenticating
    independently, overwhelming the authentication service.
    
     - Reading cookie file is lockless, file update atomic with mv
     - Requesting auth & writing out obtained cookie is locked
     - To be able to break stale lock the lockfile is empty, cookie is saved
       to a separate tmeporary file
    
    Cookie file contains the whole Set-Cookie header content. It would be
    possible to add support for multiple cookies but OBS only ever sets one
    cookie so multiple cookies are not supported.
    
    Signed-off-by: Michal Suchanek <msuchanek@suse.de>
    
        
file modified
+128 -5