'Update the syncing users for an external process as a delta.
Args:
process_id (str): An identifier for the process the users are
syncing against. This allows synapse to process updates
as user start and stop syncing against a given process.
user_id (str): The user who has started or stopped syncing
is_syncing (bool): Whether or not the user is now syncing
sync_time_msec(int): Time in ms when the user was last syncing'

@defer.inlineCallbacks
def update_external_syncs_row(self, process_id, user_id, is_syncing, sync_time_msec):

    with (yield self.external_sync_linearizer.queue(process_id)):
        prev_state = (yield self.current_state_for_user(user_id))
        process_presence = self.external_process_to_current_syncs.setdefault(process_id, set())
        updates = []
        if (is_syncing and (user_id not in process_presence)):
            if (prev_state.state == PresenceState.OFFLINE):
                updates.append(prev_state.copy_and_replace(state=PresenceState.ONLINE, last_active_ts=sync_time_msec, last_user_sync_ts=sync_time_msec))
            else:
                updates.append(prev_state.copy_and_replace(last_user_sync_ts=sync_time_msec))
            process_presence.add(user_id)
        elif (user_id in process_presence):
            updates.append(prev_state.copy_and_replace(last_user_sync_ts=sync_time_msec))
        if (not is_syncing):
            process_presence.discard(user_id)
        if updates:
            (yield self._update_states(updates))
        self.external_process_last_updated_ms[process_id] = self.clock.time_msec()
