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

fix(skymp5-client): prevent profiling file overwrites by adding random suffix #2239

Merged
merged 1 commit into from
Dec 2, 2024

Conversation

Pospelove
Copy link
Contributor

@Pospelove Pospelove commented Dec 2, 2024

Important

Add random suffix to profiling output file names in ProfilingService to prevent overwrites.

  • Behavior:
    • Modify file naming in ProfilingService to include a random suffix, preventing overwrites of profile.cpuprofile files.

This description was created by Ellipsis for 0015e1a. It will automatically update as commits are pushed.

@ellipsis-dev ellipsis-dev bot changed the title . fix: prevent profiling file overwrites by adding random suffix Dec 2, 2024
@Pospelove Pospelove changed the title fix: prevent profiling file overwrites by adding random suffix fix(skymp5-client): prevent profiling file overwrites by adding random suffix Dec 2, 2024
Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Reviewed everything up to 0015e1a in 33 seconds

More details
  • Looked at 14 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_ANluMcS8Lre2MLCa


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@@ -62,7 +62,8 @@ export class ProfilingService extends ClientListener {
});
});

fs.writeFileSync('./profile.cpuprofile', JSON.stringify(profile));
const fileNameSuffix = Math.random().toString().replace(".0", "");
fs.writeFileSync(`./profile${fileNameSuffix}.cpuprofile`, JSON.stringify(profile));
Copy link

Choose a reason for hiding this comment

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

Consider using a more robust method for generating unique file names, such as incorporating a timestamp or using a UUID.

@Pospelove Pospelove merged commit 0898981 into skyrim-multiplayer:main Dec 2, 2024
13 checks passed
@Pospelove Pospelove deleted the profilefilename branch December 2, 2024 15:07
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.

1 participant