Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize seeding #1398

Merged
merged 2 commits into from Nov 28, 2018
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Next

Don't call torrent.load when a FS path is seeded

  • Loading branch information
KayleePop committed May 17, 2018
commit c49ae22d52417e976533e364fbf98ce8c41df384
@@ -257,13 +257,17 @@ class WebTorrent extends EventEmitter {
this._debug('seed')
opts = opts ? Object.assign({}, opts) : {}

const isFilePath = typeof input === 'string'

// When seeding from fs path, initialize store from that path to avoid a copy
if (typeof input === 'string') opts.path = path.dirname(input)
if (isFilePath) opts.path = path.dirname(input)
if (!opts.createdBy) opts.createdBy = `WebTorrent/${VERSION_STR}`

const onTorrent = torrent => {
const tasks = [
cb => {
// when a filesystem path is specified, files are already in the FS store
if (isFilePath) return cb()
torrent.load(streams, cb)
}
]
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.