MCPcopy
hub / github.com/FlareSolverr/FlareSolverr / destroy

Method destroy

src/sessions.py:59–72  ·  view source on GitHub ↗

destroy closes the driver instance and removes session from the storage. The function is noop if session_id doesn't exist. The function returns True if session was found and destroyed, and False if session_id wasn't found.

(self, session_id: str)

Source from the content-addressed store, hash-verified

57 return session_id in self.sessions
58
59 def destroy(self, session_id: str) -> bool:
60 """destroy closes the driver instance and removes session from the storage.
61 The function is noop if session_id doesn't exist.
62 The function returns True if session was found and destroyed,
63 and False if session_id wasn't found.
64 """
65 if not self.exists(session_id):
66 return False
67
68 session = self.sessions.pop(session_id)
69 if utils.PLATFORM_VERSION == "nt":
70 session.driver.close()
71 session.driver.quit()
72 return True
73
74 def get(self, session_id: str, ttl: Optional[timedelta] = None) -> Tuple[Session, bool]:
75 session, fresh = self.create(session_id)

Callers 2

createMethod · 0.95
_cmd_sessions_destroyFunction · 0.80

Calls 2

existsMethod · 0.95
quitMethod · 0.80

Tested by

no test coverage detected