Skip to content

Distinguish unfinished uploads from finished uploads #3

@Reinachan

Description

@Reinachan

Currently if you cancel an upload, it'll result in remnants of it being left behind (the folder, uploaded chunks, and the initialised file). This is no-good.

When a chunked upload is initiated, the File in the database should be marked as incomplete along with a timestamp of the latest chunk uploaded. There should be a job that runs on a regular basis that checks for incomplete files older than 10 minutes and clean up if it finds anything.

There are two approaches to how to handle this in the database

Option 1

Add columns to existing table files

ALTER TABLE files;
ADD incomplete boolean NOT NULL DEFAULT 0;
ADD latest_update datetime;

Benefits

Keeps everything in one place

Downsides

Requires nullable fields

Option 2

Add a new table chunked_files that references files

CREATE TABLE chunked_files (
    username text PRIMARY KEY NOT NULL REFERENCES users(username),
    latest_update datetime NOT NULL,
);

Benefits

  • No nullable fields
  • Clean implementation

Downsides

  • Related data is stored separately

Metadata

Metadata

Assignees

Labels

enhancementImprove upon existing functionality (minor changes)

Projects

Status

Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions