Skip to content

I am calling meteor method via celery. normally it goes well. but some it shows following error #8

Open

Description

@zahedul

File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner self.run() File "/usr/lib/python2.7/threading.py", line 763, in run self.__target(*self.__args, **self.__kwargs) File "/usr/local/lib/python2.7/dist-packages/ws4py/websocket.py", line 425, in run self.opened() File "/usr/local/lib/python2.7/dist-packages/DDPClient.py", line 26, in opened self.emit('opened') File "/usr/local/lib/python2.7/dist-packages/pyee/__init__.py", line 113, in emit f(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/DDPClient.py", line 148, in opened self.send(connect_msg) File "/usr/local/lib/python2.7/dist-packages/DDPClient.py", line 158, in send self.ddpsocket.send(msg_dict) File "/usr/local/lib/python2.7/dist-packages/DDPClient.py", line 36, in send super(DDPSocket, self).send(message) File "/usr/local/lib/python2.7/dist-packages/ws4py/websocket.py", line 261, in send self._write(m) File "/usr/local/lib/python2.7/dist-packages/ws4py/websocket.py", line 241, in _write raise RuntimeError("Cannot send on a terminated websocket") RuntimeError: Cannot send on a terminated websocket

Activity

  1. theblazehen commented on May 6, 2016

    @theblazehen

    Can you pass debug=True when you create the connection? That way we can see if the connection is dropping before you send data.

  2. zahedul commented on May 18, 2016

    @zahedul
    Author

    My code is:

    from DDPClient import DDPClient
    from celery import Celery
    from celery.utils.log import get_task_logger
    
    import time
    
    logger = get_task_logger(__name__)
    
    isReconnect = True
    reconnectTimeOut = 60
    isDebug = True 
    URL = 'ws://my-url/websocket'
    
    app = Celery('tasks')
    app.config_from_object('celeryconfig')
    
    def callback_function(data):
        print('I am here');
        print data
    
    def connected(self):
        print '* CONNECTED'
    
    def closed(code, reason):
        print '* CONNECTION CLOSED {} {}'.format(code, reason)
    
    def reconnected(self):
        print '* RECONNECTED'
    
    def failed(collection, data):
        print '* FAILED - data: {}'.format(str(data))
    
    @app.task
    def processScheduleOrder():
        print("start processScheduleOrder")
        logger.info("start processScheduleOrder")
    
        client = DDPClient(URL, auto_reconnect=isReconnect, auto_reconnect_timeout=reconnectTimeOut, debug=isDebug)
    
        client.on('connected', connected)
        client.on('socket_closed', closed)
        client.on('reconnected', reconnected)
        client.on('failed', failed)
    
        client.connect()
        client.call('processScheduleOrder', [])
        client.close()
        logger.info("end processScheduleOrder")
    

    In every 30 min this method call 3 times. Sometimes it connect ddp client successfully. But sometimes it failed, and show error what I share already. If I set debug as true it return same error.
    I also test callback function. but not luck. What am I missing

    Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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