question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

playerProfile keeps the same data for every user.

See original GitHub issue

Hello. Me and my friend are trying to do a simple app that would take all the steam64ids from mysql and then use the id in playerProfileRequest.

`var j = schedule.scheduleJob(‘*/5 * * * * *’, function(){ var array = [];

con.query("SELECT * FROM counterStrikeGlobalOffensive", function (err, rows) {
	for (var i = 0; i < rows.length; i++) {
		console.log(rows[i].steam64ID);
		CSGOCli.playerProfileRequest(CSGOCli.ToAccountID(rows[i].steam64ID));
		CSGOCli.on("playerProfile", function(profile) {
			console.log(profile.account_profiles[0].ranking.rank_id);
			return;
		});
	}
});

return; });`

This is where my problem begins. When I do console.log(rows[i].steam64ID, it returns all of the ids that are in the mysql. Then I put the id in playerProfileRequest and then when I do console.log(profile), it keeps repeating the same data for each steamid.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
joshuaferraracommented, Aug 13, 2017

Something like this. I haven’t tested this code, so your mileage may vary. It’s not even the best way to go about it, but it should work. I specifically don’t like adding a new callback every time it iterates, but I don’t have any time to debug it or make it more efficient. This should help out a bit, though. The idea is that it’s similar to forEach on an array, but because we have asynchronous callbacks, just using forEach will iterate over the entire array and disregard the asynchronous operations. By using the async package and the eachSeries, we don’t iterate until callback() is called from within our last asynchronous operation.

1reaction
joshuaferraracommented, Aug 2, 2017

Don’t spam the GC. Wait until you get a playerProfile, then call playerProfileRequest again with the next steam ID you want info on.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Keep user and user profile in different tables?
User profile data, which includes users preferences, latest activity, status updates etc. Note that there are some attributes about the user ...
Read more >
User profile and all of my data is gone / windows 10
My user profile and all my data, docs, photos, music, videos have disappeared from my laptop running windows 10. I was using my...
Read more >
Supporting Multiple Users | Android Open Source Project
A profile is a subset of, and tied to, the existence of a user. A user can have multiple profiles. Profiles are created...
Read more >
Best Practices for Identifying Users | Segment Documentation
The most important calls you make with Segment are the Track and Identify calls. With the Track call, you can attribute actions on...
Read more >
Manage User Accounts and Settings in Windows 10
Every user account is also classified as either: ... The Windows 10 system of user profiles allows more than one person to use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found