import { WorkspaceSubscriptionNanoWaitingEventRecord } from '../../../../../../../../server-services/query-records/workspace-records';
import { waitingNanosQuery } from '../../../../../../../../server-services/querys';
import { WorkspaceChangeSubscriptionSpecificHandler } from '../types';

export let onCreateNanoWaitinEventSubscriptionHandler: WorkspaceChangeSubscriptionSpecificHandler =
  (cache, event: WorkspaceSubscriptionNanoWaitingEventRecord) => {
    cache.getCacheDataByRequest({ query: waitingNanosQuery, variables: {} })[event.waiterId] =
      event.aliveUntil;
  };
