You've already forked FrameTour-RenderWorker
- 实现跨进程缓存锁获取和释放功能 - 在下载过程中使用UUID生成唯一的临时文件名避免并发覆盖 - 添加超时机制和轮询间隔控制锁等待时间 - 修改清理逻辑跳过锁文件和下载中的临时文件 - 添加测试验证缓存锁功能正常工作 fix(ffmpeg): 优化FFmpeg命令执行和错误处理 - 添加默认日志级别为error减少冗余输出 - 修复subprocess运行参数传递方式 - 改进错误信息截取避免空值解码异常 refactor(system-info): 优化系统信息获取和缓存机制 - 实现FFmpeg版本、编解码器信息缓存避免重复查询 - 添加系统信息TTL缓存机制提升性能 - 实现GPU信息检查状态缓存避免重复检测 - 整合静态系统信息和动态信息分离处理 refactor(storage): 优化HTTP上传下载资源管理 - 使用上下文管理器确保请求连接正确关闭 - 修改rclone命令构建方式从字符串改为列表形式 - 改进错误处理截取stderr输出长度限制 - 优化响应处理避免资源泄露
16 lines
489 B
Python
16 lines
489 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
import os
|
|
|
|
from services.cache import MaterialCache, _extract_cache_key
|
|
|
|
|
|
def test_cache_lock_acquire_release(tmp_path):
|
|
cache = MaterialCache(cache_dir=str(tmp_path), enabled=True, max_size_gb=0)
|
|
cache_key = _extract_cache_key("https://example.com/path/file.mp4?token=abc")
|
|
lock_path = cache._acquire_lock(cache_key)
|
|
assert lock_path
|
|
assert os.path.exists(lock_path)
|
|
cache._release_lock(lock_path)
|
|
assert not os.path.exists(lock_path)
|