clawkeep 0.2.3 → 0.2.5
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.
- package/package.json +1 -1
- package/src/core/backup.js +4 -5
- package/src/core/transport.js +4 -4
package/package.json
CHANGED
package/src/core/backup.js
CHANGED
|
@@ -157,11 +157,10 @@ class BackupManager {
|
|
|
157
157
|
freshConfig.backup.lastSync = new Date().toISOString();
|
|
158
158
|
this.claw.saveConfig(freshConfig);
|
|
159
159
|
|
|
160
|
-
//
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
transport.reportSync({ chunkCount, totalSize }).catch(() => {});
|
|
160
|
+
// Notify cloud API that a sync occurred (fire-and-forget)
|
|
161
|
+
// The API reads real stats from R2 — we just ping it.
|
|
162
|
+
if (target === 'cloud' && transport && transport.reportSync) {
|
|
163
|
+
transport.reportSync().catch(() => {});
|
|
165
164
|
}
|
|
166
165
|
|
|
167
166
|
return { ...result, lastSync: freshConfig.backup.lastSync };
|
package/src/core/transport.js
CHANGED
|
@@ -182,11 +182,11 @@ class CloudTransport extends BackupTransport {
|
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
/**
|
|
185
|
-
*
|
|
185
|
+
* Notify the cloud API that a sync occurred (fire-and-forget).
|
|
186
|
+
* The API reads actual stats from R2 — we just ping it.
|
|
186
187
|
*/
|
|
187
|
-
async reportSync(
|
|
188
|
+
async reportSync() {
|
|
188
189
|
const url = `${this.endpoint}/api/workspaces/${this.workspace}/sync-report`;
|
|
189
|
-
const body = JSON.stringify({ chunk_count: chunkCount, storage_bytes: totalSize });
|
|
190
190
|
try {
|
|
191
191
|
await new Promise((resolve, reject) => {
|
|
192
192
|
const parsed = new URL(url);
|
|
@@ -204,7 +204,7 @@ class CloudTransport extends BackupTransport {
|
|
|
204
204
|
});
|
|
205
205
|
req.on('error', reject);
|
|
206
206
|
req.setTimeout(15000, () => req.destroy(new Error('Sync report timeout')));
|
|
207
|
-
req.end(
|
|
207
|
+
req.end('{}');
|
|
208
208
|
});
|
|
209
209
|
} catch {
|
|
210
210
|
// Fire-and-forget: don't fail the sync if report fails
|