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

Commit 153595a

Browse files
authored
Remove sleep desnecessário antes de toda requisição (#72)
* move sleep time * atualiza pacotes * corrige testes * remove NIX do CI * corrige ci?
1 parent b935de1 commit 153595a

File tree

7 files changed

+244
-309
lines changed

7 files changed

+244
-309
lines changed

Diff for: .github/workflows/pypi.yml

+27-30
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,31 @@ jobs:
99
deploy:
1010
runs-on: ubuntu-22.04
1111
steps:
12-
- uses: actions/checkout@v4
13-
14-
- name: Instala nix single user
15-
run: |
16-
BASE_URL='https://raw.githubusercontent.com/ES-Nix/get-nix/' \
17-
&& SHA256=87fa0f1dbfdd28a1f99b39d5bd4dcc39de97bc64 \
18-
&& NIX_RELEASE_VERSION='2.10.2' \
19-
&& curl -fsSL "${BASE_URL}""$SHA256"/get-nix.sh | sh -s -- ${NIX_RELEASE_VERSION} \
20-
&& . "$HOME"/.nix-profile/etc/profile.d/nix.sh \
21-
&& . ~/."$(basename $SHELL)"rc \
22-
&& export TMPDIR=/tmp \
23-
&& nix flake --version \
24-
&& nix registry pin nixpkgs github:NixOS/nixpkgs/ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b \
25-
&& curl -fsSL https://raw.githubusercontent.com/ES-Nix/get-nix/"$SHA256"/install_direnv_and_nix_direnv.sh | sh \
26-
&& . ~/."$(basename $SHELL)"rc \
27-
&& direnv --version
28-
echo "$HOME"/.nix-profile/bin >> $GITHUB_PATH
29-
30-
- name: Install dependencies
31-
run: |
32-
nix develop .# --command sh -c 'make poetry.config.venv && make poetry.install'
33-
34-
- name: build package
35-
run: |
36-
nix develop .# --command sh -c 'make package.build'
37-
38-
- name: deploy package
39-
env:
40-
PASSWORD: ${{ secrets.PYPI_TOKEN }}
41-
run: nix develop .# --command sh -c 'make package.publish PASSWORD=$PASSWORD'
12+
- uses: actions/checkout@v4
13+
14+
- uses: actions/setup-python@v5
15+
with:
16+
python-version: '3.9'
17+
18+
- name: Install and configure Poetry
19+
uses: snok/install-poetry@v1
20+
with:
21+
version: 1.8.2
22+
virtualenvs-create: false
23+
virtualenvs-in-project: false
24+
virtualenvs-path: .
25+
26+
- name: Install dependencies
27+
run: |
28+
make poetry.config.venv
29+
make poetry.install
30+
31+
- name: build package
32+
run: |
33+
make package.build
34+
35+
- name: deploy package
36+
env:
37+
PASSWORD: ${{ secrets.PYPI_TOKEN }}
38+
run: make package.publish PASSWORD=$PASSWORD
4239

Diff for: .github/workflows/tests.yml

+29-77
Original file line numberDiff line numberDiff line change
@@ -16,99 +16,51 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v4
1818

19-
- name: Instala nix single user
20-
run: |
21-
BASE_URL='https://raw.githubusercontent.com/ES-Nix/get-nix/' \
22-
&& SHA256=87fa0f1dbfdd28a1f99b39d5bd4dcc39de97bc64 \
23-
&& NIX_RELEASE_VERSION='2.10.2' \
24-
&& curl -fsSL "${BASE_URL}""$SHA256"/get-nix.sh | sh -s -- ${NIX_RELEASE_VERSION} \
25-
&& . "$HOME"/.nix-profile/etc/profile.d/nix.sh \
26-
&& . ~/."$(basename $SHELL)"rc \
27-
&& export TMPDIR=/tmp \
28-
&& nix flake --version \
29-
&& nix registry pin nixpkgs github:NixOS/nixpkgs/ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b \
30-
&& curl -fsSL https://raw.githubusercontent.com/ES-Nix/get-nix/"$SHA256"/install_direnv_and_nix_direnv.sh | sh \
31-
&& . ~/."$(basename $SHELL)"rc \
32-
&& direnv --version
33-
echo "$HOME"/.nix-profile/bin >> $GITHUB_PATH
19+
- uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.9'
22+
23+
- name: Install and configure Poetry
24+
uses: snok/install-poetry@v1
25+
with:
26+
version: 1.8.2
27+
virtualenvs-create: false
28+
virtualenvs-in-project: false
29+
virtualenvs-path: .
3430

3531
- name: Install dependencies
3632
run: |
37-
nix develop .# --command sh -c 'make poetry.config.venv && make poetry.install'
33+
make poetry.config.native
34+
make poetry.install
3835
3936
- name: Lint code with black
4037
run: |
41-
nix develop .# --command sh -c 'make fmt.check'
38+
make fmt.check
4239
4340
test:
4441
runs-on: ubuntu-22.04
4542
steps:
4643
- uses: actions/checkout@v4
4744

48-
- name: Instala nix single user
49-
run: |
50-
BASE_URL='https://raw.githubusercontent.com/ES-Nix/get-nix/' \
51-
&& SHA256=87fa0f1dbfdd28a1f99b39d5bd4dcc39de97bc64 \
52-
&& NIX_RELEASE_VERSION='2.10.2' \
53-
&& curl -fsSL "${BASE_URL}""$SHA256"/get-nix.sh | sh -s -- ${NIX_RELEASE_VERSION} \
54-
&& . "$HOME"/.nix-profile/etc/profile.d/nix.sh \
55-
&& . ~/."$(basename $SHELL)"rc \
56-
&& export TMPDIR=/tmp \
57-
&& nix flake --version \
58-
&& nix registry pin nixpkgs github:NixOS/nixpkgs/ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b \
59-
&& curl -fsSL https://raw.githubusercontent.com/ES-Nix/get-nix/"$SHA256"/install_direnv_and_nix_direnv.sh | sh \
60-
&& . ~/."$(basename $SHELL)"rc \
61-
&& direnv --version
62-
echo "$HOME"/.nix-profile/bin >> $GITHUB_PATH
63-
64-
- name: Install dependencies
65-
run: |
66-
nix develop .# --command sh -c 'make poetry.config.venv && make poetry.install'
67-
68-
- name: Show dependencies
69-
run: |
70-
nix develop .# --command sh -c 'python --version && poetry show --tree'
71-
72-
- name: Config env
73-
run: nix develop .# --command sh -c 'make config.env'
74-
75-
- name: Test with pytest
76-
run: nix develop .# --command sh -c 'make test'
77-
78-
coverage:
79-
runs-on: ubuntu-22.04
80-
needs: test
81-
steps:
82-
- uses: actions/checkout@v4
45+
- uses: actions/setup-python@v5
46+
with:
47+
python-version: '3.9'
8348

84-
- name: Instala nix single user
85-
run: |
86-
BASE_URL='https://raw.githubusercontent.com/ES-Nix/get-nix/' \
87-
&& SHA256=87fa0f1dbfdd28a1f99b39d5bd4dcc39de97bc64 \
88-
&& NIX_RELEASE_VERSION='2.10.2' \
89-
&& curl -fsSL "${BASE_URL}""$SHA256"/get-nix.sh | sh -s -- ${NIX_RELEASE_VERSION} \
90-
&& . "$HOME"/.nix-profile/etc/profile.d/nix.sh \
91-
&& . ~/."$(basename $SHELL)"rc \
92-
&& export TMPDIR=/tmp \
93-
&& nix flake --version \
94-
&& nix registry pin nixpkgs github:NixOS/nixpkgs/ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b \
95-
&& curl -fsSL https://raw.githubusercontent.com/ES-Nix/get-nix/"$SHA256"/install_direnv_and_nix_direnv.sh | sh \
96-
&& . ~/."$(basename $SHELL)"rc \
97-
&& direnv --version
98-
echo "$HOME"/.nix-profile/bin >> $GITHUB_PATH
49+
- name: Install and configure Poetry
50+
uses: snok/install-poetry@v1
51+
with:
52+
version: 1.8.2
53+
virtualenvs-create: false
54+
virtualenvs-in-project: false
55+
virtualenvs-path: .
9956

10057
- name: Install dependencies
10158
run: |
102-
nix develop .# --command sh -c 'make poetry.config.venv && make poetry.install'
59+
make poetry.config.native
60+
make poetry.install
10361
10462
- name: Config env
105-
run: |
106-
nix develop .# --command sh -c 'make config.env'
107-
108-
- name: make coverage
109-
run: |
110-
nix develop .# --command sh -c 'make coverage'
63+
run: make config.env
11164

112-
- uses: codecov/codecov-action@v4
113-
with:
114-
file: ./coverage.xml # optional
65+
- name: Test with pytest
66+
run: make test

Diff for: bb_wrapper/wrapper/request.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ def wrapper(func):
1818
def inner(*args, counter=None, **kwargs):
1919
counter = counter if counter is not None else max_retries
2020
try:
21-
sleep_time = random.randint(1, 90) / 100
22-
sleep(sleep_time)
2321
return func(*args, **kwargs)
2422
except (ConnectionResetError, ConnectionError, ProtocolError):
2523
if counter > 0:
2624
counter -= 1
25+
sleep_time = random.randint(1, 90) / 100
26+
sleep(sleep_time)
2727
return inner(*args, counter=counter, **kwargs)
2828
raise
2929

0 commit comments

Comments
 (0)