Repository navigation
YouTube: post pushed videos without waiting for the feed, log late notices once; random music uses all its services - #344
Merged
Merged
Conversation
… una vez por video
… 3 minutos, log de avisos; música aleatoria usa todos sus servicios
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
1. The late-notice log line (a bug of #343).
YouTube: "…" reached the notice N min after it was published (…)was written while a channel was being looked at, for every recent video it had, on every look, so after a restart it flooded#general-logs. Now the engine writes it when a notice is really sent, once for each video (however many servers follow the channel), and only when it goes out more than 8 minutes after publication.2. A video YouTube pushes is posted without waiting for the feed of the channel. A channel that Carlbot announced one minute after upload was not announced by Petto for over 15 minutes: its row in
youtube_websubshowed no push after the upload (the last one was 3 hours earlier, for an old video whose data changed), and the feed of the channel can take minutes to show a new video. The push body already carries the new entry (id, title, link, date), so:3. Random music always picked Deezer at a 5-minute pace. The service of a slot was chosen with
slot * 2654435761; at a 5-minute pace the slot is about 6 million, the product is past what a JavaScript number keeps exactly and its last bit is always 0, so with two services (no Spotify keys) the same one was chosen every time (checked: 8 slots in a row, all Deezer; Apple answers when asked). The hash now usesMath.imul(exact in 32 bits) and the service is chosen with its high bits, so Deezer, Apple Music and Spotify (with keys) alternate.How it was checked
npm run checkpasses with the test database and with an empty environment like the CI (feeds, i18n, types, the whole suite). New assertions: a poll writes no late line, a late video gives one line (once for two servers), a pushed video is posted although the feed does not show it, the intervals for 300 / 1500 / more channels, and both and all services are chosen over 40 consecutive 5-minute slots.Not tested against the real YouTube hub or a real Discord server. Why the push for that video never arrived is not known yet: the new log lines will show whether it comes to the bot and is ignored, or does not come.