chore: automated housekeeping...

This commit is contained in:
Pieter Vander Vennet 2025-06-18 21:40:01 +02:00
parent 94c61744c0
commit 04c8ccb0d2
89 changed files with 2353 additions and 1390 deletions

View file

@ -180,13 +180,13 @@ export class ImageUploadManager {
queue = [...queue]
while (queue.length > 0) {
const currentItem = queue.shift()
if(!currentItem){
if (!currentItem) {
continue
}
const uploadOk = await this.handleQueueItem(currentItem)
if(uploadOk){
if (uploadOk) {
this._queue.delete(currentItem)
}else{
} else {
// Our local 'queue' is a copy where we've removed the failed item from
// A next attempt to 'uploadQueue' will retry the upload
}
@ -255,7 +255,7 @@ export class ImageUploadManager {
if (properties === undefined) {
const downloaded = await new OsmObjectDownloader(
this._osmConnection.Backend(),
this._changes,
this._changes
).DownloadObjectAsync(args.featureId)
if (downloaded === "deleted") {
this._queue.delete(args)
@ -264,16 +264,10 @@ export class ImageUploadManager {
this._featureProperties.trackFeature(downloaded.asGeoJson())
properties = this._featureProperties.getStore(args.featureId)
}
const action = new LinkImageAction(
args.featureId,
result.key,
result.value,
properties,
{
theme: args.layoutId ?? properties?.data?.["_orig_theme"] ?? this._theme.id,
changeType: "add-image",
},
)
const action = new LinkImageAction(args.featureId, result.key, result.value, properties, {
theme: args.layoutId ?? properties?.data?.["_orig_theme"] ?? this._theme.id,
changeType: "add-image",
})
await this._changes.applyAction(action)
await this._changes.flushChanges("Image upload completed")
return true