Skip to content

The collection has been marked as complete with regards to additions. #919

@Franco-Vera

Description

@Franco-Vera

hi,

Pusharp version 4.0.10
About 10% of daily push notifications are getting this error. until now i think is aleatory...

context: this is a webservices than just send 1 notification for every call. and for the same device sometimes works and sometimes fails.

Mensaje: The collection has been marked as complete with regards to additions.
StackTrace: at System.Collections.Concurrent.BlockingCollection1.TryAddWithNoTimeValidation(T item, Int32 millisecondsTimeout, CancellationToken cancellationToken) at PushSharp.Core.ServiceBroker1.QueueNotification(TNotification notification)
at Connection_Push

By doing many tests I was able to verify that the error occurs when I run the service many times in a very short time.

For example, running the service every one second is no problem, but 10 times in one second the error is generated.

any suggestion?

MY CODE

                       GcmConfiguration config = new GcmConfiguration(fcmkey);
                        config.GcmUrl = GoogleFCM;

                        fcmBroker = new GcmServiceBroker(config);
                        fcmBroker.Start();

                        fcmBroker.OnNotificationFailed += (notification, aggregateEx) =>
                        {
                            aggregateEx.Handle(ex =>
                            { 
                                status.status = "ERROR SENDING PUSH";
                                status.description = ex.Message;
                                return true;
                            });
                        };
                        fcmBroker.OnNotificationSucceeded += (notification) =>
                        {
                            status.status = "Success";
                            status.description = "Send proccess finished";
                        };

                        while (fcmBroker.IsCompleted) { } //my desesperation but not working

                        fcmBroker.QueueNotification(new GcmNotification
                        {
                            RegistrationIds = new List<string> { _dr[0].ToString() },
                            Data = JObject.Parse(jsonconv)
                        });

                        fcmBroker.Stop();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions