Skip to content
This repository has been archived by the owner on Jan 24, 2025. It is now read-only.

Remove sleep desnecessário antes de toda requisição #72

Merged
merged 5 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
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
57 changes: 27 additions & 30 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,31 @@ jobs:
deploy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Instala nix single user
run: |
BASE_URL='https://raw.githubusercontent.com/ES-Nix/get-nix/' \
&& SHA256=87fa0f1dbfdd28a1f99b39d5bd4dcc39de97bc64 \
&& NIX_RELEASE_VERSION='2.10.2' \
&& curl -fsSL "${BASE_URL}""$SHA256"/get-nix.sh | sh -s -- ${NIX_RELEASE_VERSION} \
&& . "$HOME"/.nix-profile/etc/profile.d/nix.sh \
&& . ~/."$(basename $SHELL)"rc \
&& export TMPDIR=/tmp \
&& nix flake --version \
&& nix registry pin nixpkgs github:NixOS/nixpkgs/ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b \
&& curl -fsSL https://raw.githubusercontent.com/ES-Nix/get-nix/"$SHA256"/install_direnv_and_nix_direnv.sh | sh \
&& . ~/."$(basename $SHELL)"rc \
&& direnv --version
echo "$HOME"/.nix-profile/bin >> $GITHUB_PATH

- name: Install dependencies
run: |
nix develop .# --command sh -c 'make poetry.config.venv && make poetry.install'

- name: build package
run: |
nix develop .# --command sh -c 'make package.build'

- name: deploy package
env:
PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: nix develop .# --command sh -c 'make package.publish PASSWORD=$PASSWORD'
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.9'

- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.2
virtualenvs-create: false
virtualenvs-in-project: false
virtualenvs-path: .

- name: Install dependencies
run: |
make poetry.config.venv
make poetry.install

- name: build package
run: |
make package.build

- name: deploy package
env:
PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: make package.publish PASSWORD=$PASSWORD

106 changes: 29 additions & 77 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,99 +16,51 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Instala nix single user
run: |
BASE_URL='https://raw.githubusercontent.com/ES-Nix/get-nix/' \
&& SHA256=87fa0f1dbfdd28a1f99b39d5bd4dcc39de97bc64 \
&& NIX_RELEASE_VERSION='2.10.2' \
&& curl -fsSL "${BASE_URL}""$SHA256"/get-nix.sh | sh -s -- ${NIX_RELEASE_VERSION} \
&& . "$HOME"/.nix-profile/etc/profile.d/nix.sh \
&& . ~/."$(basename $SHELL)"rc \
&& export TMPDIR=/tmp \
&& nix flake --version \
&& nix registry pin nixpkgs github:NixOS/nixpkgs/ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b \
&& curl -fsSL https://raw.githubusercontent.com/ES-Nix/get-nix/"$SHA256"/install_direnv_and_nix_direnv.sh | sh \
&& . ~/."$(basename $SHELL)"rc \
&& direnv --version
echo "$HOME"/.nix-profile/bin >> $GITHUB_PATH
- uses: actions/setup-python@v5
with:
python-version: '3.9'

- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.2
virtualenvs-create: false
virtualenvs-in-project: false
virtualenvs-path: .

- name: Install dependencies
run: |
nix develop .# --command sh -c 'make poetry.config.venv && make poetry.install'
make poetry.config.native
make poetry.install

- name: Lint code with black
run: |
nix develop .# --command sh -c 'make fmt.check'
make fmt.check

test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Instala nix single user
run: |
BASE_URL='https://raw.githubusercontent.com/ES-Nix/get-nix/' \
&& SHA256=87fa0f1dbfdd28a1f99b39d5bd4dcc39de97bc64 \
&& NIX_RELEASE_VERSION='2.10.2' \
&& curl -fsSL "${BASE_URL}""$SHA256"/get-nix.sh | sh -s -- ${NIX_RELEASE_VERSION} \
&& . "$HOME"/.nix-profile/etc/profile.d/nix.sh \
&& . ~/."$(basename $SHELL)"rc \
&& export TMPDIR=/tmp \
&& nix flake --version \
&& nix registry pin nixpkgs github:NixOS/nixpkgs/ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b \
&& curl -fsSL https://raw.githubusercontent.com/ES-Nix/get-nix/"$SHA256"/install_direnv_and_nix_direnv.sh | sh \
&& . ~/."$(basename $SHELL)"rc \
&& direnv --version
echo "$HOME"/.nix-profile/bin >> $GITHUB_PATH

- name: Install dependencies
run: |
nix develop .# --command sh -c 'make poetry.config.venv && make poetry.install'

- name: Show dependencies
run: |
nix develop .# --command sh -c 'python --version && poetry show --tree'

- name: Config env
run: nix develop .# --command sh -c 'make config.env'

- name: Test with pytest
run: nix develop .# --command sh -c 'make test'

coverage:
runs-on: ubuntu-22.04
needs: test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'

- name: Instala nix single user
run: |
BASE_URL='https://raw.githubusercontent.com/ES-Nix/get-nix/' \
&& SHA256=87fa0f1dbfdd28a1f99b39d5bd4dcc39de97bc64 \
&& NIX_RELEASE_VERSION='2.10.2' \
&& curl -fsSL "${BASE_URL}""$SHA256"/get-nix.sh | sh -s -- ${NIX_RELEASE_VERSION} \
&& . "$HOME"/.nix-profile/etc/profile.d/nix.sh \
&& . ~/."$(basename $SHELL)"rc \
&& export TMPDIR=/tmp \
&& nix flake --version \
&& nix registry pin nixpkgs github:NixOS/nixpkgs/ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b \
&& curl -fsSL https://raw.githubusercontent.com/ES-Nix/get-nix/"$SHA256"/install_direnv_and_nix_direnv.sh | sh \
&& . ~/."$(basename $SHELL)"rc \
&& direnv --version
echo "$HOME"/.nix-profile/bin >> $GITHUB_PATH
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.2
virtualenvs-create: false
virtualenvs-in-project: false
virtualenvs-path: .

- name: Install dependencies
run: |
nix develop .# --command sh -c 'make poetry.config.venv && make poetry.install'
make poetry.config.native
make poetry.install

- name: Config env
run: |
nix develop .# --command sh -c 'make config.env'

- name: make coverage
run: |
nix develop .# --command sh -c 'make coverage'
run: make config.env

- uses: codecov/codecov-action@v4
with:
file: ./coverage.xml # optional
- name: Test with pytest
run: make test
4 changes: 2 additions & 2 deletions bb_wrapper/wrapper/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ def wrapper(func):
def inner(*args, counter=None, **kwargs):
counter = counter if counter is not None else max_retries
try:
sleep_time = random.randint(1, 90) / 100
sleep(sleep_time)
return func(*args, **kwargs)
except (ConnectionResetError, ConnectionError, ProtocolError):
if counter > 0:
counter -= 1
sleep_time = random.randint(1, 90) / 100
sleep(sleep_time)
return inner(*args, counter=counter, **kwargs)
raise

Expand Down
Loading