[keyserver] move async iife to standalone function
Summary:
keyserver.js is already massive, and the async iife in the middle makes it harder to follow
Depends on D13667
Test Plan:
cleared the access token from the metadata table and ran keyserver as a secondary node. confirmed that node polled every 5 seconds for identity info.
killed and ran keyserver as primary. access token was added to metadata table.
killed and ran keyserver as secondary again. node was able to fetch access token and did not get stuck in loop
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D13694