(list, thisMissing)
| 172 | // Sync |
| 173 | |
| 174 | export async function syncList(list, thisMissing) { |
| 175 | for (const i in list) { |
| 176 | const el = list[i]; |
| 177 | if (el.diff) { |
| 178 | try { |
| 179 | await syncListItem(el); |
| 180 | el.diff = false; |
| 181 | } catch (e) { |
| 182 | con.error(e); |
| 183 | } |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | const missing = thisMissing.slice(); |
| 188 | for (const i in missing) { |
| 189 | const miss = missing[i]; |
| 190 | con.log('Sync missing', miss); |
| 191 | await syncMissing(miss) |
| 192 | .then(() => { |
| 193 | thisMissing.splice(thisMissing.indexOf(miss), 1); |
| 194 | }) |
| 195 | .catch(e => { |
| 196 | con.error('Error', e); |
| 197 | miss.error = e; |
| 198 | }); |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | export async function syncListItem(item) { |
| 203 | for (let i = 0; i < item.slaves.length; i++) { |
no test coverage detected