def write(self, value):
        def error(e):
            _log.warning("Error during write: {}".format(e))
            done() # Call done to wake scheduler, not sure this is a good idea

        def done(unused=None):
            self._changed = True # Let can_read know there may be something new to read
            self.scheduler_wakeup()

        self._pushed_values += len(value)
        try:
            value = json.dumps(value) # Convert to string for sqlite
        except TypeError:
            _log.error("Value is not json serializable")
        else:
            q = self.db.runOperation("INSERT INTO queue (value) VALUES (?)", (value, ))
            q.addCallback(done)
            q.addErrback(error)