V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  TomeWong  ›  全部回复第 1 页 / 共 3 页
回复总数  47
1  2  3  
2020-11-23 14:52:34 +08:00
回复了 TomeWong 创建的主题 程序员 web worker 解决 Electron 渲染进程大量计算问题?
@agoodob 数据存储用的是 levelDB,页面渲染使用的是 vue-virtual-scroller
2020-07-21 14:39:35 +08:00
回复了 TomeWong 创建的主题 程序员 html 调用 class 封装的 js,无反应
@azcvcza 谢谢
2020-07-14 09:08:34 +08:00
回复了 lwp2070809 创建的主题 程序员 2020.07.13 15:00 Github 部分服务降级
由于疫情原因,微软的服务器被盗了
2020-07-02 10:52:20 +08:00
回复了 TomeWong 创建的主题 程序员 this.callback && (this.callback.call(this, 'cancel'))
@wednesdayco 感觉没有关系
2020-06-24 17:14:40 +08:00
回复了 TomeWong 创建的主题 程序员 web 端播放 流式音频(m3u8 格式)
@Jiangyf ckplayer 有版权信息
2020-06-24 12:55:53 +08:00
回复了 TomeWong 创建的主题 程序员 web 端播放 流式音频(m3u8 格式)
@liuguang hls 对 IE 浏览器的兼容性不太好
2020-06-12 09:33:58 +08:00
回复了 kmdd33 创建的主题 上海 组个微信群: echo ("上海程序员内推找工作 wechat 群");
MTg4OTY3MjU0MDk= 谢谢
2020-05-18 10:46:06 +08:00
回复了 TomeWong 创建的主题 程序员 electron 在 web worker 子线程中无法引入 sqlite3
@96412hj 不经过 web worker postMessage 传递数据,而是直接在 web worker 中处理
@jones2000 但会一直往 vuex 中写入数据的
@jones2000 一次显示 20 条,往下拖动滚动条会往当前屏幕上累加显示,上传成功的会从当前屏中移除掉
@dinjufen 是的,vuex 在本地会生成一个 vuex.json,上传进度会频繁的在 vuex.json 中更新
@lp4298707 postMeassge 只有第一次传的数据量很大,如果不将这部分数据渲染至页面中,是没有问题的,处理的还是挺快的
@lp4298707 小数据量是非常快的,现在一下上传 2 万个文件,页面过个几分钟就卡死了
@xiongotom 好的,我试下,谢谢啦
@VDimos 在 vuex 中使用 map 来处理,可能会有问题
@Vegetable 是一个一个上传的,并发量为 3,上传是正常的,在上传前会先根据每条文件的路径获取一些信息,然后再将这些信息通过 postMessage 回传至 worker 主进程,在 worker 主进程将这些处理的信息更新至 vuex 中,这个更新过程出现了问题
@wednesdayco 现在都是小文件,可以正常上传,但将 web worker 中处理的信息回传至 worker 主进程,更新至 vuex 有问题,vuex 是不是存在存储大小限制的问题
是否转换字符串来传输,而不是数组对象
```
self.onmessage = async event => {
console.log(event)
const { diskType, files, dirpath, sid, usn, currentFileId, currentGroupId, currentCreatedByUsn, baseUrl, uploadLimit, uploadSpeed } = event.data
const queueData = [],
taskDataArr = []
let completeStatus
for (let elem of files) {
const filePath = elem,
// stats = await fs.promises.stat(filePath).catch(error => console.log(error)),
// size = stats.size,
chunkSize = 5 * 1024 * 1024, //每片分块的大小 5M
// pieces = Math.ceil(size / chunkSize),
uploadType = pieces == 1 ? 1 : 3,
num = filePath.lastIndexOf('\\') + 1,
name = filePath.substring(num),
uuid = uuidv4(),
basename = dirpath ? path.basename(dirpath) : '',
realPath = dirpath ? filePath.substring(filePath.indexOf(basename), filePath.lastIndexOf("\\")).replace(/\\/g, "/") : ''
const payload = {
appFileId: "",
diskType: diskType,
uploadType: uploadType,
creatorUsn: currentCreatedByUsn || usn,
parentid: currentFileId == -2 ? -1 : currentFileId || -1,
groupId: diskType == 1 ? '' : currentGroupId,
fileSize: 0,
fileName: name,
fileMd5: '',
fileRealPath: realPath,
comeFrom: 30,
model: 0,
discussContent: ""
}
const queueItemData = { sid, uuid, payload, name, size, currentFileId, uploadType, pieces, chunkSize, filePath, currentCreatedByUsn, baseUrl, uploadLimit, uploadSpeed }
// taskDataArr.push({ filePath, name, uuid, size, pieces, uploadType, diskType, parentid: currentFileId == -2 ? -1 : currentFileId || -1, fileRealPath: realPath })
taskDataArr.push({ filePath, name, uuid, size, pieces, uploadType, diskType, parentid: currentFileId == -2 ? -1 : currentFileId || -1, fileRealPath: realPath })
queueData.push(queueItemData)

}
completeStatus = {
status: 'updateStore'
}
self.postMessage({taskDataArr, completeStatus})
}
```
2020-04-29 10:49:03 +08:00
回复了 TomeWong 创建的主题 程序员 web worker 中不能使用 node.js fs.promises?
@joe237 好的,谢谢
1  2  3  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1538 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 20ms · UTC 17:05 · PVG 01:05 · LAX 10:05 · JFK 13:05
Developed with CodeLauncher
♥ Do have faith in what you're doing.