channel-worker 1.0.17 → 1.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -88,32 +88,41 @@ class CommandPoller {
88
88
  const baseExtPath = this.config.extension_path || '';
89
89
  let extensionPath = baseExtPath;
90
90
 
91
- // Create per-profile extension dir with config.json containing profileId
91
+ // Create unique extension dir each launch prevents Chromium bytecode cache
92
92
  if (baseExtPath && profile_id) {
93
93
  const fs = require('fs');
94
94
  const path = require('path');
95
- const profileExtPath = baseExtPath + '-' + profile_id;
95
+ const ts = Date.now();
96
+ const uniqueExtPath = baseExtPath + '-' + profile_id + '-' + ts;
96
97
  try {
97
- // Copy extension files to per-profile dir (if not exists or outdated)
98
- if (!fs.existsSync(profileExtPath)) fs.mkdirSync(profileExtPath, { recursive: true });
98
+ fs.mkdirSync(uniqueExtPath, { recursive: true });
99
99
  const files = fs.readdirSync(baseExtPath);
100
100
  for (const f of files) {
101
101
  const src = path.join(baseExtPath, f);
102
- const dst = path.join(profileExtPath, f);
103
- if (fs.statSync(src).isFile()) {
104
- // Copy if newer
105
- const srcMtime = fs.statSync(src).mtimeMs;
106
- const dstMtime = fs.existsSync(dst) ? fs.statSync(dst).mtimeMs : 0;
107
- if (srcMtime > dstMtime) fs.copyFileSync(src, dst);
108
- }
102
+ if (fs.statSync(src).isFile()) fs.copyFileSync(src, path.join(uniqueExtPath, f));
109
103
  }
110
104
  // Write profile-specific config.json
111
- const config = { channelManagerApi: 'https://api.channel.tunasm.art', profileId: profile_id };
112
- fs.writeFileSync(path.join(profileExtPath, 'config.json'), JSON.stringify(config));
113
- extensionPath = profileExtPath;
114
- console.log(`[commands] Extension dir: ${profileExtPath} (profile: ${profile_id})`);
105
+ fs.writeFileSync(path.join(uniqueExtPath, 'config.json'), JSON.stringify({
106
+ channelManagerApi: 'https://api.channel.tunasm.art',
107
+ profileId: profile_id,
108
+ }));
109
+ extensionPath = uniqueExtPath;
110
+ console.log(`[commands] Extension dir: ${uniqueExtPath}`);
111
+
112
+ // Cleanup old dirs (keep last 3)
113
+ const parent = path.dirname(baseExtPath);
114
+ const baseName = path.basename(baseExtPath);
115
+ const oldDirs = fs.readdirSync(parent)
116
+ .filter(d => d.startsWith(baseName + '-') && d !== path.basename(uniqueExtPath))
117
+ .map(d => path.join(parent, d))
118
+ .filter(d => fs.statSync(d).isDirectory())
119
+ .sort()
120
+ .slice(0, -3);
121
+ for (const d of oldDirs) {
122
+ try { fs.rmSync(d, { recursive: true }); } catch {}
123
+ }
115
124
  } catch (e) {
116
- console.warn(`[commands] Per-profile ext dir failed: ${e.message}, using base`);
125
+ console.warn(`[commands] Unique ext dir failed: ${e.message}, using base`);
117
126
  }
118
127
  }
119
128
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "channel-worker",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "description": "Channel Manager worker daemon — runs on remote machines to execute video pipeline jobs",
5
5
  "main": "lib/daemon.js",
6
6
  "bin": {