Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from __future__ import annotations

import json
import time
from collections.abc import Sequence
from functools import cached_property
from typing import TYPE_CHECKING, Any
Expand Down Expand Up @@ -216,6 +217,7 @@ class SlackAPIFileOperator(SlackAPIOperator):
"content",
"title",
"snippet_type",
"interval",
)
ui_color = "#44BEDF"

Expand All @@ -229,6 +231,7 @@ def __init__(
title: str | None = None,
method_version: Literal["v1", "v2"] = "v2",
snippet_type: str | None = None,
interval: float = 0.0,
**kwargs,
) -> None:
super().__init__(method="files.upload", **kwargs)
Expand All @@ -240,6 +243,7 @@ def __init__(
self.title = title
self.method_version = method_version
self.snippet_type = snippet_type
self.interval = interval

@property
def _method_resolver(self):
Expand All @@ -258,3 +262,7 @@ def execute(self, context: Context):
title=self.title,
snippet_type=self.snippet_type,
)

if self.interval > 0:
self.log.debug("Sleeping %.2fs to respect interval", self.interval)
time.sleep(self.interval)
Loading