(cloudData cloudmodel.Resource)
| 119 | } |
| 120 | |
| 121 | func (d *domain) tryRefresh(cloudData cloudmodel.Resource) error { |
| 122 | // 无论是否会更新资源,需先更新domain及subdomain状态 |
| 123 | d.updateStateInfo(cloudData) |
| 124 | |
| 125 | if err := d.shouldRefresh(cloudData); err != nil { |
| 126 | return err |
| 127 | } |
| 128 | |
| 129 | select { |
| 130 | case <-d.cache.RefreshSignal: |
| 131 | d.cache.IncrementSequence() |
| 132 | d.cache.SetLogLevel(logging.INFO, cache.RefreshSignalCallerDomain) |
| 133 | |
| 134 | d.refresh(cloudData) |
| 135 | |
| 136 | d.cache.ResetRefreshSignal(cache.RefreshSignalCallerDomain) |
| 137 | return nil |
| 138 | default: |
| 139 | log.Info("domain refresh is running, does nothing", d.metadata.LogPrefixes) |
| 140 | return RefreshConflictError |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | func (d *domain) shouldRefresh(cloudData cloudmodel.Resource) error { |
| 145 | if cloudData.Verified { |
no test coverage detected