Skip to content

Commit c0c9698

Browse files
committed
use raw datastore rather than ndb for counting users
1 parent 4e8bd00 commit c0c9698

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

ide/routes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,9 @@
4040
import functools
4141
import urllib.parse
4242

43-
from google.cloud import ndb
43+
from google.cloud import ndb, datastore
4444
from google.auth.transport import requests
4545
from google.oauth2 import id_token
46-
from google.cloud import ndb
4746

4847
from .models import User, Program, Folder, Setting
4948

@@ -253,8 +252,9 @@ def update_user_count():
253252
except Exception:
254253
return flask.Response('Forbidden', status=403)
255254

256-
stat = ndb.Key('__Stat_Kind__', 'User').get()
257-
count = stat.count if stat else 0
255+
ds_client = datastore.Client()
256+
stat = ds_client.get(ds_client.key('__Stat_Kind__', 'User'))
257+
count = stat['count'] if stat else 0
258258

259259
history_setting = ndb.Key('Setting', 'user_count_history').get()
260260
if not history_setting:

0 commit comments

Comments
 (0)