Sql guest users

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
Does anyone has any idea why we need to fill in database with guest users? We released new online store 2 weeks ago and latest registered customer id already 8900. When I want to delete guest customers from admin panel it takes ages and log's me off. Only one easy way to delete them by using MSSQL management studio.
Does anyone experienced this issue? Or nobody cares about it?
12 years ago
Here's what I found so far regarding the creation of guest accounts:

- each time a registered user logs out, a new guest account is created (because the customer cookie is always set to the registered user's guid when they log in and when they log out that guid is not used as guest because it references a registered user, so a new one is created, updating the customer cookie, and so on) - for that I suggest to only write the customer cookie when the user is NOT a registered one nor a search engine;

- a new guest account is created for each hit for anything that don't store cookies, such as crawlers. Your browsercap file needs to be updated or you need to make sure that the method IsSearchEngine of your IWebHelper returns true when the request is a crawler;

That being said, by default, a check is made each hour to delete guest accountst that have been inactive for 24 hours. Because the column is an identity seed, the IDs keep getting bigger and bigger. Since the limit is (2^32 / 2) - 1, you could have 100 000 accounts created per day and be ok for the next 58 years. However, one could remove the identity, create a function to get the next available ID (using gaps) and assign that to each created user (that could be done in a DbContext's SaveChanges override).
12 years ago
Wow I like this 58 years :)

I made some change in the code from Codeplex Change Set fbdb86078a0b it helps a bit.

Anyway my questions was what's the reason to register every guest customer?
12 years ago
It allows to be able to add items to the shopping cart, wishlist and do various things that guests can (or cannot do) depending on settings. The method that gets the current customer is used everywhere. If that method was to return a mocked customer, every bit that uses it would have to react appropriately.
12 years ago
There is an entry on the Web.Config that relates to SCHEDULING
and when executes it deletes the GUEST accounts automatically.

...meaning that you do NOT need to delete them manually from the Management Studio.
NopCommerce does it for you automatically.

==========================================================================
Here is the Web.Config entry:

<ScheduleTasks>
      <!--run each hour: 60*60=3600-->
      <Thread seconds="3600">
        <task name="DeleteGuestsTask" type="Nop.Services.Customers.DeleteGuestsTask, Nop.Services" enabled="true" stopOnError="false" olderThanMinutes="1440"/>
      </Thread>
</ScheduleTasks>

If u need to clear Guest Accounts faster, just change the Thread "seconds" parameter to something smaller.
12 years ago
SDSharp wrote:
There is an entry on the Web.Config that relates to SCHEDULING
and when executes it deletes the GUEST accounts automatically.

...meaning that you do NOT need to delete them manually from the Management Studio.
NopCommerce does it for you automatically.

==========================================================================
Here is the Web.Config entry:

<ScheduleTasks>
      <!--run each hour: 60*60=3600-->
      <Thread seconds="3600">
        <task name="DeleteGuestsTask" type="Nop.Services.Customers.DeleteGuestsTask, Nop.Services" enabled="true" stopOnError="false" olderThanMinutes="1440"/>
      </Thread>
</ScheduleTasks>

If u need to clear Guest Accounts faster, just change the Thread "seconds" parameter to something smaller.


I have this code in the web.config but it's not working? it doesn't clear the guest users in table customers.
I have to go to the sql and clear them manually, any idea I'm using Nop 2.10.
12 years ago
I know there is a difference between guest customers and
guest customers with items on the shopping cart.

On 2.30 we have a menu item on the Admin / System / Maintenance
that allows to delete both types.

Not sure about 2.10 ..sorry.
12 years ago
SDSharp wrote:

On 2.30 we have a menu item on the Admin / System / Maintenance
that allows to delete both types.

Not sure about 2.10 ..sorry.


I have these options in 2.10 !!! that means you have to do it manually even on 2.30 ?
12 years ago
every time somebody (even yourself) goes to any page on the site, it creates a Guess user.
that's how the site handles "non registered users".

did the menu deleted entries on the db ?
12 years ago
I was just thinking about this today: a guest customer is created for each unauthenticated request that does not send a cookie that corresponds to an already created customer (containing the guid). So if a client (browser, bot - not registered as a search engine) that does not support cookies is making lots of requests, one guest customer would be created for each request. That could significantly increase the CustomerId identity. I know the limit is quite high, but I still think maybe something better could be done. Could cookie support be checked before creating guest customers? If they're not supported, then the default guest customer could be used?

What do you think?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.