Open SaintAngeLs opened 1 month ago
This issue will also be aligned with the Paralax development. We will have to eliminate possible null refferencial exceptions.
o": null,
"Pageable": null
}
[20:54:02 INF] Executed endpoint 'HTTP: GET events/search'
[20:54:02 ERR] An error occurred while processing the request.
MongoDB.Driver.Linq.ExpressionNotSupportedException: Expression not supported: Convert(e.Organizer.OrganizationId, Guid).
at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToFilterTranslators.ToFilterFieldTranslators.ConvertExpressionToFilterFieldTranslator.Translate(TranslationContext context, UnaryExpression expression)
at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToFilterTranslators.ToFilterFieldTranslators.ExpressionToFilterFieldTranslator.Translate(TranslationContext context, Expression expression)
at MongoDB.Driver.Linq.Linq3Implementation.LinqProviderAdapterV3.TranslateExpressionToField[TDocument,TField](Expression`1 expression, IBsonSerializer`1 documentSerializer, IBsonSerializerRegistry serializerRegistry, Boolean allowScalarValueForArrayField)
at MongoDB.Driver.ExpressionFieldDefinition`2.Render(RenderArgs`1 args)
at MongoDB.Driver.SingleItemAsArrayOperatorFilterDefinition`2.Render(RenderArgs`1 args)
at MongoDB.Driver.AndFilterDefinition`1.Render(RenderArgs`1 args)
at MongoDB.Driver.AndFilterDefinition`1.Render(RenderArgs`1 args)
at MongoDB.Driver.PipelineStageDefinitionBuilder.<>c__DisplayClass35_0`1.<Match>b__0(RenderArgs`1 args)
at MongoDB.Driver.DelegatedPipelineStageDefinition`2.Render(RenderArgs`1 args)
at MongoDB.Driver.AppendedStagePipelineDefinition`3.Render(RenderArgs`1 args)
at MongoDB.Driver.AppendedStagePipelineDefinition`3.Render(RenderArgs`1 args)
at MongoDB.Driver.MongoCollectionImpl`1.AggregateAsync[TResult](IClientSessionHandle session, PipelineDefinition`2 pipeline, AggregateOptions options, CancellationToken cancellationToken)
at MongoDB.Driver.MongoCollectionImpl`1.UsingImplicitSessionAsync[TResult](Func`2 funcAsync, CancellationToken cancellationToken)
at MongoDB.Driver.IAsyncCursorSourceExtensions.ToListAsync[TDocument](IAsyncCursorSource`1 source, CancellationToken cancellationToken)
at MiniSpace.Services.Events.Infrastructure.Mongo.Repositories.Extensions.AggregateByPage[TDocument](IMongoCollection`1 collection, FilterDefinition`1 filterDefinition, SortDefinition`1 sortDefinition, Int32 page, Int32 pageSize) in /home/kaliuser/Documents/portfolio/commercial_apps/distributed_minispace/MiniSpace.Services.Events/src/MiniSpace.Services.Events.Infrastructure/Mongo/Repositories/Extensions.cs:line 40
at MiniSpace.Services.Events.Infrastructure.Mongo.Repositories.EventMongoRepository.BrowseAsync(FilterDefinition`1 filterDefinition, SortDefinition`1 sortDefinition, Int32 pageNumber, Int32 pageSize) in /home/kaliuser/Documents/portfolio/commercial_apps/distributed_minispace/MiniSpace.Services.Events/src/MiniSpace.Services.Events.Infrastructure/Mongo/Repositories/EventMongoRepository.cs:line 47
at MiniSpace.Services.Events.Infrastructure.Mongo.Repositories.EventMongoRepository.BrowseEventsAsync(Int32 pageNumber, Int32 pageSize, String name, String organizer, DateTime dateFrom, DateTime dateTo, Nullable`1 category, Nullable`1 state, IEnumerable`1 organizations, IEnumerable`1 friends, Nullable`1 friendsEngagementType, IEnumerable`1 sortBy, String direction) in /home/kaliuser/Documents/portfolio/commercial_apps/distributed_minispace/MiniSpace.Services.Events/src/MiniSpace.Services.Events.Infrastructure/Mongo/Repositories/EventMongoRepository.cs:line 72
at MiniSpace.Services.Events.Infrastructure.Mongo.Queries.Handlers.GetPaginatedSearchEventsHandler.HandleAsync(GetSearchEvents query, CancellationToken cancellationToken) in /home/kaliuser/Documents/portfolio/commercial_apps/distributed_minispace/MiniSpace.Services.Events/src/MiniSpace.Services.Events.Infrastructure/Mongo/Queries/Handlers/GetPaginatedSearchEventsHandler.cs:line 61
at Paralax.CQRS.Queries.Dispatchers.QueryDispatcher.QueryAsync[TQuery,TResult](TQuery query, CancellationToken cancellationToken)
at Paralax.WebApi.CQRS.Builders.DispatcherEndpointsBuilder.<>c__DisplayClass3_0`2.<<Get>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Paralax.WebApi.EndpointsBuilder.BuildQueryContext[T](HttpContext httpContext, Func`3 context)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|7_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at App.Metrics.AspNetCore.Tracking.Middleware.ApdexMiddleware.MeasureTransaction(HttpContext context)
at App.Metrics.AspNetCore.Tracking.Middleware.PerRequestTimerMiddleware.TimeTransaction(HttpContext context)
at App.Metrics.AspNetCore.Tracking.Middleware.RequestTimerMiddleware.TimeTransaction(HttpContext context)
at App.Metrics.AspNetCore.Tracking.Middleware.ErrorRequestMeterMiddleware.Invoke(HttpContext context)
at App.Metrics.AspNetCore.Tracking.Middleware.ActiveRequestCounterEndpointMiddleware.Invoke(HttpContext context)
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
at Paralax.WebApi.Exceptions.ErrorHandlerMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
[20:54:02 INF] Request finished HTTP/1.1 GET http://localhost:5000/events/search?OrganizationId=3be66f89-
@SaintAngeLs, I remember you've mentioned the nullable values in convert query method in Paralax. it has nothing to deal with it. The issue is that the Organizer(Enumerator Type).OrganizationId(Also nullable Type) is compared as the string to Guid.
Description:
Currently, the Event Service is making direct calls to the Friends Service in the
GetEventHandler
whenever an event is fetched. This process introduces unnecessary latency and potential points of failure, as the entire event retrieval process is dependent on the availability and response time of the Friends Service. This inefficiency affects the performance of the Event Service, especially when handling requests at scale.Problem:
When the Event Service queries an event, it calls the Friends Service to retrieve the friends data of the user requesting the event. This dependency introduces the following issues:
GetEvent
query is extended by the need to call the Friends Service.GetEvent
request, even when the friends data is not critical for all use cases.Proposed Solution:
Refactor the Event Service to decouple the Friends Service calls from the
GetEvent
query:GetEventHandler
should no longer call the Friends Service when retrieving events.GetEvent
query.Alternatives Considered:
Additional Context: