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

Fixes for active rooms #41

Merged
merged 1 commit into from
Jun 23, 2016
Merged

Conversation

KenavR
Copy link
Contributor

@KenavR KenavR commented Jun 23, 2016

  1. By changing the query I removed rooms that only have posts from the bot
  2. It is slow for @megamattron because the subsequent queries to fill the first five entries only read the amount of rooms that where missing, but since you are joined a couple of hundred rooms, I think the initial state generation made a lot of queries requesting only one room. Now it always loads 30, this may be a lot better for you, but it overloads for users which are joined only a handful of rooms. I don't know what's the best amount, I guess to figure out the most efficient limit, we need some data about how many rooms an average user is in.

Maybe changing the 1 month period into 2 weeks would be better, since sandersforpresident is first without a message in two weeks.

…nce for people with a couple hundred joined rooms
@KenavR KenavR mentioned this pull request Jun 23, 2016
@megamattron megamattron merged commit 236c177 into larvalabs:master Jun 23, 2016
@megamattron
Copy link
Member

Merged it and I think I'm also going to lower the time threshold on the query to try and make it more about rooms that have been active recently. I'll try a low number like 3 days and see how it goes.

@KenavR
Copy link
Contributor Author

KenavR commented Jun 23, 2016

Is it faster for you?

@megamattron
Copy link
Member

I haven't deployed it yet, I'm getting an error when I run it on my dev machine, I think because the timeframe is shorter so it's returning less (or no) rooms, trying to figure it out.

Basically it's this:

play.exceptions.JavaExecutionException: org.hibernate.exception.DataException: could not extract ResultSet
    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:231)
    at Invocation.HTTP Request(Play!)
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.DataException: could not extract ResultSet
    at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387)
    at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1310)
    at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:277)
    at com.larvalabs.redditchat.services.ActiveRoomsService.findMostActiveRooms(ActiveRoomsService.java:61)
    at com.larvalabs.redditchat.dataobj.JsonActiveRoomsUtil.getActiveRooms(JsonActiveRoomsUtil.java:26)
    at com.larvalabs.redditchat.dataobj.JsonUtil.loadFullStateForUser(JsonUtil.java:110)
    at controllers.WebSocket.room(WebSocket.java:124)
    at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:544)
    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:494)
    at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:489)
    at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:458)
    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:162)
    ... 1 more
Caused by: org.hibernate.exception.DataException: could not extract ResultSet
    at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:135)
    at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:124)
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109)
    at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:88)
    at org.hibernate.loader.Loader.getResultSet(Loader.java:2062)
    at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1859)
    at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1838)
    at org.hibernate.loader.Loader.doQuery(Loader.java:906)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:348)
    at org.hibernate.loader.Loader.doList(Loader.java:2550)
    at org.hibernate.loader.Loader.doList(Loader.java:2536)
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2366)
    at org.hibernate.loader.Loader.list(Loader.java:2361)
    at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:340)
    at org.hibernate.internal.SessionImpl.listCustomQuery(SessionImpl.java:1788)
    at org.hibernate.internal.AbstractSessionImpl.list(AbstractSessionImpl.java:232)
    at org.hibernate.internal.SQLQueryImpl.list(SQLQueryImpl.java:157)
    at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:268)
    ... 10 more
Caused by: org.postgresql.util.PSQLException: ERROR: OFFSET must not be negative
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2284)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2003)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:200)
    at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:424)
    at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:161)
    at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:114)
    at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:79)
    ... 24 more

@megamattron
Copy link
Member

Ok I think I've got it fixed, deploying now.

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