Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pci-kubernetes): streams listing #12613

Merged
merged 2 commits into from
Aug 5, 2024
Merged

Conversation

frenautvh
Copy link
Contributor

Question Answer
Branch? feat/DTCORE-2445
Bug fix? no
New feature? yes
Breaking change? no
Tickets DTCORE-2485
License BSD 3-Clause

Description

Add kubernetes streams listing

@frenautvh frenautvh requested review from a team as code owners August 1, 2024 15:28
@frenautvh frenautvh requested review from kqesar, seven-amid, antonymarion, MaximeBajeux and oalkabouss and removed request for a team August 1, 2024 15:28
@github-actions github-actions bot added the feature New feature label Aug 1, 2024
@frenautvh frenautvh requested a review from sidlynx August 1, 2024 15:29
@github-actions github-actions bot added the has conflicts Has conflicts to resolve before merging label Aug 1, 2024
@github-actions github-actions bot removed the has conflicts Has conflicts to resolve before merging label Aug 1, 2024
Comment on lines +215 to +234
export const pollOperation = async (
serviceName: string,
operationId: string,
intervalMs = 1000,
) => {
const poll = async () => {
const { data: op } = await v6.get(
`/dbaas/logs/${serviceName}/operation/${operationId}`,
);
if (op.state === 'SUCCESS') {
return op;
}
if (op.state === 'ERROR') {
throw new Error(op);
}
await new Promise((resolve) => setTimeout(resolve, intervalMs));
return poll();
};
return poll();
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: Can we use refetchInterval on useQuery for polling.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a good point and i tried to use useQuery at first but it turned out to be more complicated for a few reason :

  • you want to have a conditional refetch interval so you have to define an additional state to handle the operation status
  • you need to synchronize the useMutation so the onSuccess / onError is called only once the polling is done

i think it's simpler this way because the polling is done at a lower api level and the creation/deletion call will only be resolved once the operation is complete (which is what you always want) ; you also don't need the cache capabilities offered by react-query

Base automatically changed from feat/DTCORE-2445 to feat/pci-kubernetes August 2, 2024 11:40
@github-actions github-actions bot added the has conflicts Has conflicts to resolve before merging label Aug 2, 2024
ref: DTCORE-2485
Signed-off-by: Florian Renaut <florian.renaut@corp.ovh.com>
@github-actions github-actions bot removed the has conflicts Has conflicts to resolve before merging label Aug 2, 2024
ref: DTCORE-2486
Signed-off-by: Florian Renaut <florian.renaut@corp.ovh.com>
Copy link

sonarcloud bot commented Aug 5, 2024

@frenautvh frenautvh merged commit 63f6d60 into feat/pci-kubernetes Aug 5, 2024
13 of 14 checks passed
@frenautvh frenautvh deleted the feat/DTCORE-2485 branch August 5, 2024 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants