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

Add items and properties counts to PlatformStatsSummaryJob #795

Merged
merged 15 commits into from
May 14, 2024

Conversation

dati18
Copy link
Contributor

@dati18 dati18 commented May 8, 2024

No description provided.

Copy link
Contributor

@m90 m90 left a comment

Choose a reason for hiding this comment

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

This looks good, I left an idea about how to get rid of the duplication of code that this now introduces. Let me know what you think.

app/Jobs/PlatformStatsSummaryJob.php Outdated Show resolved Hide resolved
app/Jobs/PlatformStatsSummaryJob.php Outdated Show resolved Hide resolved
tests/Jobs/PlatformStatsSummaryJobTest.php Outdated Show resolved Hide resolved
tests/Jobs/PlatformStatsSummaryJobTest.php Outdated Show resolved Hide resolved
Copy link
Contributor

@m90 m90 left a comment

Choose a reason for hiding this comment

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

I left two more final comments, other than that 🚀

//this function is used to fetch pages on namespace
function fetchPagesInNamespace(string $wikiDomain, int $namespace): array
{
$this->apiUrl = getenv('PLATFORM_MW_BACKEND_HOST').'/w/api.php';
Copy link
Contributor

@m90 m90 May 14, 2024

Choose a reason for hiding this comment

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

Nitpick: I feel the trait reading configuration values all by itself is a bit of "overstepping" its own responsibilities (the trait shouldn't have any idea how it's being configured), so how about:

  • setting the apiUrl prop in the class constructors as before
  • in this method, raise a RuntimeException in case it hasn't been set

@@ -28,17 +30,25 @@
*/
class PlatformStatsSummaryJob extends Job
Copy link
Contributor

Choose a reason for hiding this comment

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

This job now probably requires an increased timeout value so that in production it doesn't get killed by the supervisor while still fetching data. Other jobs that poll all wikis currently use a value of 1800 so maybe it's a good idea to use the same one here. E.g.:

public $timeout = 1800;

Copy link
Contributor

@m90 m90 left a comment

Choose a reason for hiding this comment

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

Looks good now, let's try this out in staging.

use App\Helper\MWTimestampHelper;
use App\Wiki;
use App\User;
use Illuminate\Database\DatabaseManager;
use Illuminate\Support\Facades\Http;
Copy link
Contributor

Choose a reason for hiding this comment

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

If I'm not mistaken this is not used anymore now that the code has been moved to the trait, but it also won't really hurt much.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh yes I missed that

@m90
Copy link
Contributor

m90 commented May 14, 2024

Would you mind adding a CHANGELOG entry still before merging? No need to get this reviewed though.

@dati18 dati18 merged commit dfcf15b into main May 14, 2024
5 checks passed
@dati18 dati18 deleted the WikiEntitiesCount branch May 14, 2024 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants