mirror of
https://codeberg.org/demostf/mover.git
synced 2026-06-03 09:54:17 +02:00
flake reorg
This commit is contained in:
parent
3ef5a2ab3a
commit
f5fd05dec1
9 changed files with 691 additions and 467 deletions
16
.github/workflows/ci.yaml
vendored
Normal file
16
.github/workflows/ci.yaml
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
name: Continuous integration
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: cachix/install-nix-action@v20
|
||||||
|
- uses: icewind1991/attic-action@v1
|
||||||
|
with:
|
||||||
|
name: ci
|
||||||
|
instance: https://cache.icewind.me
|
||||||
|
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||||
|
- run: nix build
|
||||||
774
Cargo.lock
generated
774
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
18
Cargo.toml
18
Cargo.toml
|
|
@ -1,16 +1,16 @@
|
||||||
[package]
|
[package]
|
||||||
name = "mover"
|
name = "demostf-mover"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
thiserror = "1.0.30"
|
thiserror = "1.0.56"
|
||||||
demostf-client = { version = "0.4.1", default-features = false, features = ["rustls-tls"] }
|
demostf-client = { version = "0.4.3", default-features = false, features = ["rustls-tls"] }
|
||||||
tokio = { version = "1.17.0", features = ["rt-multi-thread", "macros"] }
|
tokio = { version = "1.35.1", features = ["rt-multi-thread", "macros"] }
|
||||||
tracing = "0.1.33"
|
tracing = "0.1.40"
|
||||||
tracing-subscriber = "0.3.11"
|
tracing-subscriber = "0.3.18"
|
||||||
futures-util = "0.3.21"
|
futures-util = "0.3.30"
|
||||||
main_error = "0.1.2"
|
main_error = "0.1.2"
|
||||||
dotenv = "0.15.0"
|
dotenvy = "0.15.7"
|
||||||
time = "0.3.9"
|
time = "0.3.31"
|
||||||
md5 = "0.7.0"
|
md5 = "0.7.0"
|
||||||
72
flake.lock
generated
72
flake.lock
generated
|
|
@ -1,67 +1,57 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
"locked": {
|
|
||||||
"lastModified": 1656065134,
|
|
||||||
"narHash": "sha256-oc6E6ByIw3oJaIyc67maaFcnjYOz1mMcOtHxbEf9NwQ=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "bee6a7250dd1b01844a2de7e02e4df7d8a0a206c",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"naersk": {
|
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": "nixpkgs"
|
"systems": "systems"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1655042882,
|
"lastModified": 1701680307,
|
||||||
"narHash": "sha256-9BX8Fuez5YJlN7cdPO63InoyBy7dm3VlJkkmTt6fS1A=",
|
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
|
||||||
"owner": "nix-community",
|
"owner": "numtide",
|
||||||
"repo": "naersk",
|
"repo": "flake-utils",
|
||||||
"rev": "cddffb5aa211f50c4b8750adbec0bbbdfb26bb9f",
|
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nix-community",
|
"owner": "numtide",
|
||||||
"repo": "naersk",
|
"repo": "flake-utils",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 0,
|
"lastModified": 1705183652,
|
||||||
"narHash": "sha256-A9RkoGrxzsmMm0vily18p92Rasb+MbdDMaSnzmywXKw=",
|
"narHash": "sha256-rnfkyUH0x72oHfiSDhuCHDHg3gFgF+lF8zkkg5Zihsw=",
|
||||||
"path": "/nix/store/dycwkjqxlc93s7ch3c932d0f9xvfch33-source",
|
"owner": "NixOS",
|
||||||
"type": "path"
|
"repo": "nixpkgs",
|
||||||
},
|
"rev": "428544ae95eec077c7f823b422afae5f174dee4b",
|
||||||
"original": {
|
"type": "github"
|
||||||
"id": "nixpkgs",
|
|
||||||
"type": "indirect"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs_2": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 0,
|
|
||||||
"narHash": "sha256-A9RkoGrxzsmMm0vily18p92Rasb+MbdDMaSnzmywXKw=",
|
|
||||||
"path": "/nix/store/dycwkjqxlc93s7ch3c932d0f9xvfch33-source",
|
|
||||||
"type": "path"
|
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"id": "nixpkgs",
|
"id": "nixpkgs",
|
||||||
|
"ref": "nixos-23.11",
|
||||||
"type": "indirect"
|
"type": "indirect"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
"naersk": "naersk",
|
"nixpkgs": "nixpkgs"
|
||||||
"nixpkgs": "nixpkgs_2"
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
157
flake.nix
157
flake.nix
|
|
@ -1,143 +1,46 @@
|
||||||
{
|
{
|
||||||
inputs = {
|
inputs = {
|
||||||
|
nixpkgs.url = "nixpkgs/nixos-23.11";
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
naersk.url = "github:nix-community/naersk";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, flake-utils, naersk }:
|
outputs = {
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
flake-utils,
|
||||||
|
}:
|
||||||
flake-utils.lib.eachDefaultSystem (
|
flake-utils.lib.eachDefaultSystem (
|
||||||
system: let
|
system: let
|
||||||
pkgs = nixpkgs.legacyPackages."${system}";
|
overlays = [
|
||||||
naersk-lib = naersk.lib."${system}";
|
(import ./overlay.nix)
|
||||||
in
|
];
|
||||||
rec {
|
pkgs = (import nixpkgs) {
|
||||||
# `nix build`
|
inherit system overlays;
|
||||||
packages.demomover = naersk-lib.buildPackage {
|
};
|
||||||
pname = "demomover";
|
in rec {
|
||||||
root = ./.;
|
packages = rec {
|
||||||
};
|
demostf-mover = pkgs.demostf-mover;
|
||||||
defaultPackage = packages.demomover;
|
default = demostf-mover;
|
||||||
|
};
|
||||||
|
|
||||||
# `nix run`
|
devShell = pkgs.mkShell {
|
||||||
apps.hello-world = flake-utils.lib.mkApp {
|
nativeBuildInputs = with pkgs; [rustc cargo bacon clippy cargo-audit cargo-edit];
|
||||||
drv = packages.demomover;
|
};
|
||||||
};
|
}
|
||||||
defaultApp = apps.demomover;
|
|
||||||
|
|
||||||
# `nix develop`
|
|
||||||
devShell = pkgs.mkShell {
|
|
||||||
nativeBuildInputs = with pkgs; [ rustc cargo bacon ];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
// {
|
// {
|
||||||
nixosModule = {
|
overlays.default = import ./overlay.nix;
|
||||||
|
nixosModules.default = {
|
||||||
|
pkgs,
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
|
||||||
...
|
...
|
||||||
}:
|
}: {
|
||||||
with lib; let
|
imports = [./module.nix];
|
||||||
cfg = config.services.demosmover;
|
config = lib.mkIf config.services.demostf-mover.enable {
|
||||||
in {
|
nixpkgs.overlays = [self.overlays.default];
|
||||||
options.services.demosmover = {
|
services.demostf-mover.package = lib.mkDefault pkgs.demostf-mover;
|
||||||
enable = mkEnableOption "Enables the demos mover service";
|
|
||||||
|
|
||||||
source = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
description = "source directory";
|
|
||||||
};
|
|
||||||
target = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
description = "target directory";
|
|
||||||
};
|
|
||||||
sourceBackend = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
description = "source backend";
|
|
||||||
};
|
|
||||||
targetBackend = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
description = "target backend";
|
|
||||||
};
|
|
||||||
keyFile = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
description = "file containing the api key";
|
|
||||||
};
|
|
||||||
age = mkOption {
|
|
||||||
type = types.int;
|
|
||||||
default = 78894000;
|
|
||||||
description = "age of files to move in secconds";
|
|
||||||
};
|
|
||||||
logLevel = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
default = "INFO";
|
|
||||||
description = "log level";
|
|
||||||
};
|
|
||||||
user = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
description = "user that owns the demos";
|
|
||||||
};
|
|
||||||
interval = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
default = "*:0/10";
|
|
||||||
description = "Interval to run the service";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
|
||||||
systemd.services.demosmover = let
|
|
||||||
pkg = self.defaultPackage.${pkgs.system};
|
|
||||||
in {
|
|
||||||
script = "${pkg}/bin/mover";
|
|
||||||
description = "Move demos for demos.tf";
|
|
||||||
|
|
||||||
environment = {
|
|
||||||
SOURCE_ROOT = cfg.source;
|
|
||||||
TARGET_ROOT = cfg.target;
|
|
||||||
SOURCE_BACKEND = cfg.sourceBackend;
|
|
||||||
TARGET_BACKEND = cfg.targetBackend;
|
|
||||||
AGE = toString cfg.age;
|
|
||||||
RUST_LOG = cfg.logLevel;
|
|
||||||
};
|
|
||||||
|
|
||||||
serviceConfig = {
|
|
||||||
EnvironmentFile = cfg.keyFile;
|
|
||||||
ReadWritePaths = [cfg.source cfg.target];
|
|
||||||
Restart = "on-failure";
|
|
||||||
User = cfg.user;
|
|
||||||
PrivateTmp = true;
|
|
||||||
ProtectSystem = "strict";
|
|
||||||
ProtectHome = true;
|
|
||||||
NoNewPrivileges = true;
|
|
||||||
PrivateDevices = true;
|
|
||||||
ProtectClock = true;
|
|
||||||
CapabilityBoundingSet = true;
|
|
||||||
ProtectKernelLogs = true;
|
|
||||||
ProtectControlGroups = true;
|
|
||||||
SystemCallArchitectures = "native";
|
|
||||||
ProtectKernelModules = true;
|
|
||||||
RestrictNamespaces = true;
|
|
||||||
MemoryDenyWriteExecute = true;
|
|
||||||
ProtectHostname = true;
|
|
||||||
LockPersonality = true;
|
|
||||||
ProtectKernelTunables = true;
|
|
||||||
RestrictAddressFamilies = "AF_INET AF_INET6";
|
|
||||||
RestrictRealtime = true;
|
|
||||||
ProtectProc = "noaccess";
|
|
||||||
SystemCallFilter = ["@system-service" "~@resources" "~@privileged"];
|
|
||||||
IPAddressDeny = "localhost link-local multicast";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd.timers.demosmover = {
|
|
||||||
enable = true;
|
|
||||||
description = "Move demos for demos.tf";
|
|
||||||
wantedBy = ["multi-user.target"];
|
|
||||||
timerConfig = {
|
|
||||||
OnCalendar = "*:0/10";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
112
module.nix
Normal file
112
module.nix
Normal file
|
|
@ -0,0 +1,112 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.services.demostf-mover;
|
||||||
|
in {
|
||||||
|
options.services.demostf-mover = {
|
||||||
|
enable = mkEnableOption "Enables the demos mover service";
|
||||||
|
|
||||||
|
source = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "source directory";
|
||||||
|
};
|
||||||
|
target = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "target directory";
|
||||||
|
};
|
||||||
|
sourceBackend = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "source backend";
|
||||||
|
};
|
||||||
|
targetBackend = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "target backend";
|
||||||
|
};
|
||||||
|
keyFile = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "file containing the api key";
|
||||||
|
};
|
||||||
|
age = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
default = 78894000;
|
||||||
|
description = "age of files to move in secconds";
|
||||||
|
};
|
||||||
|
logLevel = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "INFO";
|
||||||
|
description = "log level";
|
||||||
|
};
|
||||||
|
user = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "user that owns the demos";
|
||||||
|
};
|
||||||
|
interval = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "*:0/10";
|
||||||
|
description = "Interval to run the service";
|
||||||
|
};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
defaultText = literalExpression "pkgs.demostf-mover";
|
||||||
|
description = "package to use";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
systemd.services.demostf-mover = {
|
||||||
|
description = "Move demos for demos.tf";
|
||||||
|
|
||||||
|
environment = {
|
||||||
|
SOURCE_ROOT = cfg.source;
|
||||||
|
TARGET_ROOT = cfg.target;
|
||||||
|
SOURCE_BACKEND = cfg.sourceBackend;
|
||||||
|
TARGET_BACKEND = cfg.targetBackend;
|
||||||
|
AGE = toString cfg.age;
|
||||||
|
RUST_LOG = cfg.logLevel;
|
||||||
|
};
|
||||||
|
|
||||||
|
serviceConfig = {
|
||||||
|
ExecStart = "${cfg.package}/bin/demostf-mover";
|
||||||
|
EnvironmentFile = cfg.keyFile;
|
||||||
|
ReadWritePaths = [cfg.source cfg.target];
|
||||||
|
Restart = "on-failure";
|
||||||
|
User = cfg.user;
|
||||||
|
PrivateTmp = true;
|
||||||
|
ProtectSystem = "strict";
|
||||||
|
ProtectHome = true;
|
||||||
|
NoNewPrivileges = true;
|
||||||
|
PrivateDevices = true;
|
||||||
|
ProtectClock = true;
|
||||||
|
CapabilityBoundingSet = true;
|
||||||
|
ProtectKernelLogs = true;
|
||||||
|
ProtectControlGroups = true;
|
||||||
|
SystemCallArchitectures = "native";
|
||||||
|
ProtectKernelModules = true;
|
||||||
|
RestrictNamespaces = true;
|
||||||
|
MemoryDenyWriteExecute = true;
|
||||||
|
ProtectHostname = true;
|
||||||
|
LockPersonality = true;
|
||||||
|
ProtectKernelTunables = true;
|
||||||
|
RestrictAddressFamilies = "AF_INET AF_INET6";
|
||||||
|
RestrictRealtime = true;
|
||||||
|
ProtectProc = "noaccess";
|
||||||
|
SystemCallFilter = ["@system-service" "~@resources" "~@privileged"];
|
||||||
|
IPAddressDeny = "localhost link-local multicast";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.timers.demostf-mover = {
|
||||||
|
enable = true;
|
||||||
|
description = "Move demos for demos.tf";
|
||||||
|
wantedBy = ["multi-user.target"];
|
||||||
|
timerConfig = {
|
||||||
|
OnCalendar = "*:0/10";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
3
overlay.nix
Normal file
3
overlay.nix
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
final: prev: {
|
||||||
|
demostf-mover = final.callPackage ./package.nix {};
|
||||||
|
}
|
||||||
18
package.nix
Normal file
18
package.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
stdenv,
|
||||||
|
rustPlatform,
|
||||||
|
lib,
|
||||||
|
}: let
|
||||||
|
inherit (lib.sources) sourceByRegex;
|
||||||
|
src = sourceByRegex ./. ["Cargo.*" "(src)(/.*)?"];
|
||||||
|
in
|
||||||
|
rustPlatform.buildRustPackage rec {
|
||||||
|
pname = "demostf-mover";
|
||||||
|
version = "0.1.0";
|
||||||
|
|
||||||
|
inherit src;
|
||||||
|
|
||||||
|
cargoLock = {
|
||||||
|
lockFile = ./Cargo.lock;
|
||||||
|
};
|
||||||
|
}
|
||||||
16
src/main.rs
16
src/main.rs
|
|
@ -25,17 +25,17 @@ pub enum Error {
|
||||||
async fn main() -> Result<(), MainError> {
|
async fn main() -> Result<(), MainError> {
|
||||||
tracing_subscriber::fmt::init();
|
tracing_subscriber::fmt::init();
|
||||||
|
|
||||||
let mut args: HashMap<_, _> = dotenv::vars().collect();
|
let mut args: HashMap<_, _> = dotenvy::vars().collect();
|
||||||
|
|
||||||
let source_root: PathBuf = args
|
let source_root: PathBuf = args
|
||||||
.remove("SOURCE_ROOT")
|
.remove("SOURCE_ROOT")
|
||||||
.expect("no SOURCE_ROOT set")
|
.expect("no SOURCE_ROOT set")
|
||||||
.trim_end_matches("/")
|
.trim_end_matches('/')
|
||||||
.into();
|
.into();
|
||||||
let target_root: PathBuf = args
|
let target_root: PathBuf = args
|
||||||
.remove("TARGET_ROOT")
|
.remove("TARGET_ROOT")
|
||||||
.expect("no TARGET_ROOT set")
|
.expect("no TARGET_ROOT set")
|
||||||
.trim_end_matches("/")
|
.trim_end_matches('/')
|
||||||
.into();
|
.into();
|
||||||
let api_key = args.remove("KEY").expect("no KEY set");
|
let api_key = args.remove("KEY").expect("no KEY set");
|
||||||
let source_backend = args
|
let source_backend = args
|
||||||
|
|
@ -96,7 +96,7 @@ async fn move_demo(
|
||||||
) -> MainResult {
|
) -> MainResult {
|
||||||
if !source_path.is_file() {
|
if !source_path.is_file() {
|
||||||
warn!("source not found, re-downloading");
|
warn!("source not found, re-downloading");
|
||||||
re_download(&client, &target_path, &demo).await?;
|
re_download(client, &target_path, demo).await?;
|
||||||
}
|
}
|
||||||
if target_path.is_file() {
|
if target_path.is_file() {
|
||||||
warn!("target exists");
|
warn!("target exists");
|
||||||
|
|
@ -136,8 +136,8 @@ async fn move_demo(
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn generate_path(basedir: &PathBuf, name: &str) -> PathBuf {
|
fn generate_path(basedir: &Path, name: &str) -> PathBuf {
|
||||||
let mut path = basedir.clone();
|
let mut path = basedir.to_path_buf();
|
||||||
path.push(&name[0..2]);
|
path.push(&name[0..2]);
|
||||||
path.push(&name[2..4]);
|
path.push(&name[2..4]);
|
||||||
path.push(name);
|
path.push(name);
|
||||||
|
|
@ -159,7 +159,7 @@ fn hash<P: AsRef<Path>>(path: P) -> Result<[u8; 16], Error> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let data = &buff[0..read];
|
let data = &buff[0..read];
|
||||||
hash.consume(&data);
|
hash.consume(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(hash.compute().0)
|
Ok(hash.compute().0)
|
||||||
|
|
@ -169,7 +169,7 @@ fn hash<P: AsRef<Path>>(path: P) -> Result<[u8; 16], Error> {
|
||||||
async fn re_download(client: &ApiClient, target: &Path, demo: &Demo) -> Result<(), Error> {
|
async fn re_download(client: &ApiClient, target: &Path, demo: &Demo) -> Result<(), Error> {
|
||||||
let mut data = Vec::with_capacity(demo.duration as usize / 60 * 1024);
|
let mut data = Vec::with_capacity(demo.duration as usize / 60 * 1024);
|
||||||
|
|
||||||
timeout(Duration::from_secs(5 * 60), demo.save(&client, &mut data))
|
timeout(Duration::from_secs(5 * 60), demo.save(client, &mut data))
|
||||||
.await
|
.await
|
||||||
.map_err(|_| Error::Timeout)??;
|
.map_err(|_| Error::Timeout)??;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue