コード例 #1
0
def pickle_last_messages():
    while True:
        _pickle_run.wait()
        _pickle_run.clear()

        with _last_messages_lock:
            last_messages_copy = copy.deepcopy(_last_messages)
        datahandling.dump_pickle("messageData.p", last_messages_copy)
コード例 #2
0
    def _save(self):
        pickle_output = {}

        for post_id, post_site, _, _, _ in self.posts.values():
            if post_site not in pickle_output:
                pickle_output[post_site] = [post_id]
            else:
                pickle_output[post_site].append(post_id)

        datahandling.dump_pickle(PICKLE_FILENAME, pickle_output)
コード例 #3
0
def dump_cache_data():
    """
    Dump all cached data to disk in a pickle file. Not generally intended to be called by client code, but
    dispatched from tasks within this class - but it's there if you need to force a dump for some reason.

    :returns: None
    """
    datahandling.dump_pickle('metasmokeCacheData.p', {
        'cache': MetasmokeCache._cache,
        'expiries': MetasmokeCache._expiries
    })
コード例 #4
0
    def _save(self):
        with self.posts_lock:
            copy = self.posts.copy()

        datahandling.dump_pickle(PICKLE_FILENAME, copy)
コード例 #5
0
def pickle_last_messages():
    while True:
        _pickle_run.wait()
        _pickle_run.clear()

        datahandling.dump_pickle("messageData.p", _last_messages)