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

cleanup(pubsub): delete topics older than 3 days #13556

Merged
merged 4 commits into from
Feb 7, 2024

Conversation

alevenberg
Copy link
Member

@alevenberg alevenberg commented Feb 5, 2024

Ran once, went from 180 topics -> 40.

I think we might be able to delete some more (cloud-cpp) too, but I will check with someone before adding that


This change is Reviewable

@alevenberg alevenberg requested a review from a team as a code owner February 5, 2024 21:31
@product-auto-label product-auto-label bot added the api: pubsub Issues related to the Pub/Sub API. label Feb 5, 2024
@alevenberg alevenberg changed the title cleanup(pubsub): delete old topics cleanup(pubsub): delete topics older than 3 days Feb 6, 2024
Copy link

codecov bot commented Feb 6, 2024

Codecov Report

Attention: 14 lines in your changes are missing coverage. Please review.

Comparison is base (1d7f699) 93.25% compared to head (070e95b) 93.26%.
Report is 7 commits behind head on main.

Files Patch % Lines
google/cloud/pubsub/samples/topic_admin_samples.cc 74.07% 14 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #13556   +/-   ##
=======================================
  Coverage   93.25%   93.26%           
=======================================
  Files        2196     2196           
  Lines      191202   191253   +51     
=======================================
+ Hits       178307   178363   +56     
+ Misses      12895    12890    -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@scotthart scotthart left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 1 files reviewed, 4 unresolved discussions (waiting on @alevenberg)


google/cloud/pubsub/samples/topic_admin_samples.cc line 39 at r1 (raw file):

    google::cloud::pubsub_admin::TopicAdminClient& topic_admin_client,
    std::string const& project_id, absl::Time time_now) {
  std::cout << "Cleaning up old topics...\n";

If this was a debug comment, please remove it. If instead it's adding to the output of the sample code, feel free to leave it.


google/cloud/pubsub/samples/topic_admin_samples.cc line 40 at r1 (raw file):

    std::string const& project_id, absl::Time time_now) {
  std::cout << "Cleaning up old topics...\n";
  auto const parent = google::cloud::Project(project_id).FullName();

Do we need to create a variable here or can the function call be the argument to ListTopics?
There's actually a few places where you create a variable and only use it once. They might not all be necessary.


google/cloud/pubsub/samples/topic_admin_samples.cc line 41 at r1 (raw file):

  std::cout << "Cleaning up old topics...\n";
  auto const parent = google::cloud::Project(project_id).FullName();
  for (auto& topic : topic_admin_client.ListTopics(parent)) {

Can this be auto const&?


google/cloud/pubsub/samples/topic_admin_samples.cc line 44 at r1 (raw file):

    if (!topic) continue;
    auto topic_name = topic->name();
    std::string keyword = "cloud-cpp-samples";

This could be const.

Copy link
Member Author

@alevenberg alevenberg left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 1 files reviewed, 5 unresolved discussions (waiting on @devbww and @scotthart)


google/cloud/pubsub/samples/topic_admin_samples.cc line 39 at r1 (raw file):

Previously, scotthart (Scott Hart) wrote…

If this was a debug comment, please remove it. If instead it's adding to the output of the sample code, feel free to leave it.

Done.


google/cloud/pubsub/samples/topic_admin_samples.cc line 40 at r1 (raw file):

Previously, scotthart (Scott Hart) wrote…

Do we need to create a variable here or can the function call be the argument to ListTopics?
There's actually a few places where you create a variable and only use it once. They might not all be necessary.

Done.


google/cloud/pubsub/samples/topic_admin_samples.cc line 41 at r1 (raw file):

Previously, scotthart (Scott Hart) wrote…

Can this be auto const&?

Done.


google/cloud/pubsub/samples/topic_admin_samples.cc line 44 at r1 (raw file):

Previously, scotthart (Scott Hart) wrote…

This could be const.

Done.

@alevenberg alevenberg merged commit e662757 into googleapis:main Feb 7, 2024
60 of 61 checks passed
@alevenberg alevenberg deleted the isd branch February 7, 2024 19:50
@alevenberg
Copy link
Member Author

Part of #12987

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the Pub/Sub API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants