The server now sends each fresh position on every poll that has one, and sends positions advanced to send time; clients count only the time since they received it. Bars realign every poll and no longer drift by however far the viewer's clock is off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MzFywujuH9TiuXbr9vjoX8
This commit is contained in:
@@ -23,14 +23,17 @@ async function published(userId: string, fn: () => Promise<unknown>): Promise<{
|
||||
const track = (title: string, extra = {}) => ({ track: { title, artist: 'Daft Punk', ...extra }, isPlaying: true, progressMs: 1000 });
|
||||
|
||||
describe('applyPollResult', () => {
|
||||
it('publishes on a new track and queues link resolution, but not on repeat polls', async () => {
|
||||
it('publishes on a new track and queues link resolution, but not on repeat polls without a position', async () => {
|
||||
const { user } = await createUser(app(), 'bob');
|
||||
const first = await published(user.id, () => applyPollResult(user.id, 'spotify', track('One More Time')));
|
||||
expect(first).toHaveLength(1);
|
||||
expect(first[0]).toMatchObject({ track: { title: 'One More Time' }, isPlaying: true });
|
||||
expect(await resolveQueue.getJobCounts('waiting')).toMatchObject({ waiting: 1 });
|
||||
|
||||
const repeat = await published(user.id, () => applyPollResult(user.id, 'spotify', track('One More Time')));
|
||||
// (polls that carry a position do republish, to realign progress bars: see progress.test.ts)
|
||||
const repeat = await published(user.id, () =>
|
||||
applyPollResult(user.id, 'spotify', { ...track('One More Time'), progressMs: null }),
|
||||
);
|
||||
expect(repeat).toHaveLength(0);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user