Skip to content

Conversation

@HynoR
Copy link
Contributor

@HynoR HynoR commented Jan 25, 2026

What this PR does / why we need it?

#11697

已完成测试,对远端同步改动较大,合并需要慎重考虑对其他情景整体流程无误再合并!

Summary of your change

更改图标存储位置,数据库不再存图标b64,只存图标文件名+etag。
支持 etag 更新
做了向下兼容,base64图标读取仍然可用

流程图 By AI

flowchart TD
    Start([开始: SyncAppListFromRemote]) --> CheckCustomApp{是否使用<br/>自定义应用?}
    
    CheckCustomApp -->|是| ReturnNil1[返回 nil]
    CheckCustomApp -->|否| CreateTask[创建同步任务]
    
    CreateTask --> CheckTaskErr{创建任务<br/>是否成功?}
    CheckTaskErr -->|失败| ReturnError[返回错误]
    CheckTaskErr -->|成功| InitSharedCtx[初始化共享上下文]
    
    InitSharedCtx --> AddSubTask1[添加子任务1:<br/>基础同步]
    AddSubTask1 --> AddSubTask2[添加子任务2:<br/>元数据同步]
    
    AddSubTask2 --> AsyncExecute[异步执行任务]
    AsyncExecute --> ReturnNil2[主函数返回 nil]
    
    AsyncExecute -.-> SubTask1Start([子任务1: 基础同步])
    
    SubTask1Start --> GetUpdate[检查应用商店更新]
    GetUpdate --> CheckCanUpdate{可以更新?}
    
    CheckCanUpdate -->|否-正在同步| LogSyncing[记录日志并返回]
    CheckCanUpdate -->|否-已是最新| SetSkipFlag[设置跳过标志]
    SetSkipFlag --> Task1End[子任务1完成]
    
    CheckCanUpdate -->|是| GetAppListData[获取应用列表数据]
    GetAppListData --> UpdateStatus1[更新状态为同步中]
    UpdateStatus1 --> InitContext[初始化同步上下文]
    
    InitContext --> SyncTags[同步应用标签]
    SyncTags --> LoadOldApps[加载本地应用]
    LoadOldApps --> CallGetApps[构建应用映射]
    
    CallGetApps --> ClassifyPersist1[分类并持久化应用]
    ClassifyPersist1 --> UpdateStatusSuccess[更新状态为成功]
    UpdateStatusSuccess --> AssignSharedCtx[保存共享上下文]
    AssignSharedCtx --> Task1End
    
    Task1End -.-> SubTask2Start([子任务2: 元数据同步])
    
    SubTask2Start --> CheckSharedCtx{共享上下文<br/>是否有效?}
    CheckSharedCtx -->|否| ReturnNil3[返回 nil]
    
    CheckSharedCtx -->|是| CheckSkipFlag{是否跳过<br/>元数据同步?}
    CheckSkipFlag -->|是| ReturnNil4[返回 nil]
    
    CheckSkipFlag -->|否| SyncIconsDetails[同步图标和详情]
    SyncIconsDetails --> LoopApps[遍历所有应用]
    
    LoopApps --> DownloadIcon[下载图标<br/>支持ETag缓存]
    DownloadIcon --> UpdateDetails[更新应用详情<br/>README/版本等]
    UpdateDetails --> DownloadCompose[下载docker-compose]
    
    DownloadCompose --> ClassifyPersist2[分类并持久化详情]
    ClassifyPersist2 --> Task2End[子任务2完成]
    
    LogSyncing --> Task1End
    Task2End --> End([结束])
    ReturnNil1 --> End
    ReturnNil2 --> End
    ReturnNil3 --> End
    ReturnNil4 --> End
    ReturnError --> End

    style Start fill:#2e7d32,stroke:#1b5e20,stroke-width:2px,color:#fff
    style End fill:#c62828,stroke:#b71c1c,stroke-width:2px,color:#fff
    style SubTask1Start fill:#1565c0,stroke:#0d47a1,stroke-width:2px,color:#fff
    style SubTask2Start fill:#ef6c00,stroke:#e65100,stroke-width:2px,color:#fff
    style AsyncExecute fill:#6a1b9a,stroke:#4a148c,stroke-width:2px,color:#fff
    style CheckCustomApp fill:#f57f17,stroke:#f57f17,stroke-width:2px,color:#fff
    style CheckCanUpdate fill:#f57f17,stroke:#f57f17,stroke-width:2px,color:#fff
    style CheckSharedCtx fill:#f57f17,stroke:#f57f17,stroke-width:2px,color:#fff
    style CheckSkipFlag fill:#f57f17,stroke:#f57f17,stroke-width:2px,color:#fff
Loading

Please indicate you've done the following:

  • Made sure tests are passing and test coverage is added if needed.
  • Made sure commit message follow the rule of Conventional Commits specification.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed.

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Jan 25, 2026

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Jan 25, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign zhengkunwang223 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@HynoR HynoR changed the title [draft]feat: implement app icon management and caching mechanism feat: implement app icon management and caching mechanism Jan 26, 2026
@HynoR HynoR marked this pull request as ready for review January 26, 2026 11:01
- Refactored app synchronization tasks to improve structure and clarity.
- Introduced shared context for managing app sync state and metadata.
- Updated icon handling to ensure proper content type and caching.
- Adjusted cache control settings for app icons to extend cache duration.
- Improved error handling and logging during app sync processes.
…eturn

- Removed the fileName return value from GetAppIcon function as it was not utilized.
- Enhanced the GetAppIcon method in BaseApi to improve clarity and maintainability.
- Ensured proper caching headers are set for app icons.
@zhengkunwang223 zhengkunwang223 merged commit fc5e583 into 1Panel-dev:dev-v2 Jan 27, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants